From f045e6cef1f3d91f62851518a087686c754b740c Mon Sep 17 00:00:00 2001 From: Hat Kid <6624576+Hat-Kid@users.noreply.github.com> Date: Sat, 27 Jan 2024 17:27:34 +0100 Subject: [PATCH] decomp3: `font-h`, `display`, `profile`, `settings-h`, `camera-defs-h`, `text-h` (#3335) --- decompiler/config/jak3/all-types.gc | 336 ++++-- .../ntsc_v1/anonymous_function_types.jsonc | 3 + .../config/jak3/ntsc_v1/label_types.jsonc | 4 + .../config/jak3/ntsc_v1/type_casts.jsonc | 49 +- goal_src/jak3/engine/camera/camera-defs-h.gc | 52 + goal_src/jak3/engine/dma/dma-buffer.gc | 293 +++++ goal_src/jak3/engine/game/settings-h.gc | 298 +++++ goal_src/jak3/engine/gfx/font-h.gc | 721 ++++++++++++ goal_src/jak3/engine/gfx/hw/display-h.gc | 2 +- goal_src/jak3/engine/gfx/hw/display.gc | 627 ++++++++++ goal_src/jak3/engine/gfx/hw/video-h.gc | 2 + goal_src/jak3/engine/gfx/vu1-user-h.gc | 2 + goal_src/jak3/engine/ui/text-h.gc | 24 + goal_src/jak3/engine/util/profile-h.gc | 2 +- goal_src/jak3/engine/util/profile.gc | 992 ++++++++++++++++ .../reference/jak3/decompiler-macros.gc | 249 ++++ .../jak3/engine/camera/camera-defs-h_REF.gc | 104 ++ .../jak3/engine/game/settings-h_REF.gc | 679 +++++++++++ .../reference/jak3/engine/gfx/font-h_REF.gc | 781 +++++++++++++ .../jak3/engine/gfx/hw/display-h_REF.gc | 2 +- .../jak3/engine/gfx/hw/display_REF.gc | 429 +++++++ .../reference/jak3/engine/ui/text-h_REF.gc | 65 ++ .../jak3/engine/util/profile-h_REF.gc | 2 +- .../reference/jak3/engine/util/profile_REF.gc | 1032 +++++++++++++++++ 24 files changed, 6635 insertions(+), 115 deletions(-) create mode 100644 test/decompiler/reference/jak3/engine/camera/camera-defs-h_REF.gc create mode 100644 test/decompiler/reference/jak3/engine/game/settings-h_REF.gc create mode 100644 test/decompiler/reference/jak3/engine/gfx/font-h_REF.gc create mode 100644 test/decompiler/reference/jak3/engine/gfx/hw/display_REF.gc create mode 100644 test/decompiler/reference/jak3/engine/ui/text-h_REF.gc create mode 100644 test/decompiler/reference/jak3/engine/util/profile_REF.gc diff --git a/decompiler/config/jak3/all-types.gc b/decompiler/config/jak3/all-types.gc index c7896fdb86..7ab28b8e9d 100644 --- a/decompiler/config/jak3/all-types.gc +++ b/decompiler/config/jak3/all-types.gc @@ -3984,6 +3984,8 @@ (bucket582 582) (bucket583 583) (debug-no-zbuf2 584) + (bucket585 585) + (bucket586 586) ) ;; ---vu1-user-h:bucket-id @@ -4171,7 +4173,7 @@ (deftype profile-spec (structure) "Specification for a profile category." - ((name basic :offset-assert 0) + ((name symbol :offset-assert 0) (color rgba :offset-assert 4) ) :method-count-assert 9 @@ -4285,6 +4287,9 @@ :method-count-assert 9 :size-assert #x28 :flag-assert #x900000028 + (:methods + (new (symbol type int) _type_) ;; 0 + ) ) ;; (define-extern dma-buffer-inplace-new function) ;; (function dma-buffer int dma-buffer) @@ -5447,7 +5452,7 @@ (vu1-enable-user-menu vu1-renderer-mask :offset-assert 176) ;; vu1-renderer-mask (force-sync uint32 :offset-assert 184) (mem-reserve-size uint32 :offset-assert 188) - (dma-buffer-overflow basic :offset-assert 192) + (dma-buffer-overflow symbol :offset-assert 192) ) :method-count-assert 10 :size-assert #xc4 @@ -7758,19 +7763,81 @@ ;; font-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| +;; +++font-h:font-flags +(defenum font-flags + :type uint32 + :bitfield #t + (shadow 0) + (kerning 1) + (middle 2) + (middle-vert 3) + (right 4) + (large 5) + (pc-hack 6) + ) +;; ---font-h:font-flags + +;; +++font-h:font-color +(defenum font-color + :type uint32 + (default 0) + (white 1) + (transparent 2) + (red 3) + (orange 4) + (yellow 5) + (green 6) + (blue 7) + (cyan 8) + (pink 9) + (menu-selected 10) + (menu-selected-parent 11) + (menu 12) + (menu-parent 13) + (menu-func-bad 14) + (menu-flag-on 15) + (menu-flag-on-parent 16) + (menu-flag-off 17) + (menu-flag-off-parent 18) + (menu-invalid 19) + (flat-yellow 20) + (font-color-21 21) + (pad-back 22) + (pad-shine 23) + (pad-square 24) + (pad-circle 25) + (pad-triangle 26) + (pad-x 27) + (progress-old-blue 28) + (progress-old-yellow 29) + (progress-old-selected 30) + (progress-old-percent 31) + (font-color-32 32) + (font-color-33 33) + (font-color-34 34) + (font-color-35 35) + (font-color-36 36) + (font-color-37 37) + (font-color-38 38) + (font-color-39 39) + (font-color-40 40) + (font-color-41 41) + (font-color-42 42) + (font-color-43 43) + (font-color-44 44) + ) +;; ---font-h:font-color + (deftype char-verts (structure) - ((pos vector 4 :offset-assert 0) ;; guessed by decompiler - (color vector 4 :offset-assert 64) ;; guessed by decompiler - (tex-st vector 4 :offset-assert 128) ;; guessed by decompiler + ((pos vector 4 :inline :offset-assert 0) ;; guessed by decompiler + (color vector 4 :inline :offset-assert 64) ;; guessed by decompiler + (tex-st vector 4 :inline :offset-assert 128) ;; guessed by decompiler ) :method-count-assert 9 :size-assert #xc0 :flag-assert #x9000000c0 ) -|# -#| (deftype char-color (structure) ((color rgba 4 :offset-assert 0) ;; guessed by decompiler ) @@ -7778,9 +7845,7 @@ :size-assert #x10 :flag-assert #x900000010 ) -|# -#| (deftype font-context (basic) ((origin vector :inline :offset-assert 16) (strip-gif vector :inline :offset-assert 32) @@ -7799,24 +7864,22 @@ :size-assert #x58 :flag-assert #x1500000058 (:methods - (new (symbol type) _type_) ;; 0 ;; (new (symbol type matrix int int float font-color font-flags) _type_) - (font-context-method-9 () none) ;; 9 ;; (set-mat! (font-context matrix) font-context) - (font-context-method-10 () none) ;; 10 ;; (set-origin! (font-context int int) font-context) - (font-context-method-11 () none) ;; 11 ;; (set-depth! (font-context int) font-context) - (font-context-method-12 () none) ;; 12 ;; (set-w! (font-context float) font-context) - (font-context-method-13 () none) ;; 13 ;; (set-width! (font-context int) font-context) - (font-context-method-14 () none) ;; 14 ;; (set-height! (font-context int) font-context) - (font-context-method-15 () none) ;; 15 ;; (set-projection! (font-context float) font-context) - (font-context-method-16 () none) ;; 16 ;; (set-color! (font-context font-color) font-context) - (font-context-method-17 () none) ;; 17 ;; (set-flags! (font-context font-flags) font-context) - (font-context-method-18 () none) ;; 18 ;; (set-start-line! (font-context uint) font-context) - (font-context-method-19 () none) ;; 19 ;; (set-scale! (font-context float) font-context) - (font-context-method-20 () none) ;; 20 ;; (set-alpha! (font-context float) font-context) + (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 + (set-w! (font-context float) font-context) ;; 12 + (set-width! (font-context int) font-context) ;; 13 + (set-height! (font-context int) font-context) ;; 14 + (set-projection! (font-context float) font-context) ;; 15 + (set-color! (font-context font-color) font-context) ;; 16 + (set-flags! (font-context font-flags) font-context) ;; 17 + (set-start-line! (font-context uint) font-context) ;; 18 + (set-scale! (font-context float) font-context) ;; 19 + (set-alpha! (font-context float) font-context) ;; 20 ) ) -|# -#| (deftype font-work (structure) ((font-tmpl dma-gif-packet :inline :offset-assert 0) (char-tmpl dma-gif-packet :inline :offset-assert 32) @@ -7846,14 +7909,14 @@ (size-st2 vector :inline :offset-assert 432) (size-st3 vector :inline :offset-assert 448) (save vector :inline :offset-assert 464) - (save-color vector 4 :offset-assert 480) ;; guessed by decompiler - (character-save-color UNKNOWN 4 :offset-assert 544) + (save-color vector 4 :inline :offset-assert 480) ;; guessed by decompiler + (character-save-color vector 4 :inline :offset-assert 544) (current-verts char-verts :inline :offset-assert 608) (src-verts char-verts :inline :offset-assert 800) (dest-verts char-verts :inline :offset-assert 992) - (justify vector 64 :offset-assert 1184) ;; guessed by decompiler + (justify vector 64 :inline :offset-assert 1184) ;; guessed by decompiler (color-shadow vector4w :inline :offset-assert 2208) - (color-table char-color 45 :offset-assert 2224) ;; guessed by decompiler + (color-table char-color 45 :inline :offset-assert 2224) ;; guessed by decompiler (current-font-0-tmpl uint64 2 :offset-assert 2944) ;; guessed by decompiler (current-font-1-tmpl uint64 2 :offset-assert 2960) ;; guessed by decompiler (current-font-2-tmpl uint64 2 :offset-assert 2976) ;; guessed by decompiler @@ -7873,12 +7936,11 @@ (font-work-method-9 () none) ;; 9 ) ) -|# -;; (define-extern *font-default-matrix* object) ;; matrix -;; (define-extern *font-work* object) ;; font-work -;; (define-extern font-set-tex0 function) ;; (function (pointer gs-tex0) texture int int int none) -;; (define-extern set-font-color function) ;; (function font-color int rgba rgba rgba int) +(define-extern *font-default-matrix* matrix) +(define-extern *font-work* font-work) +(define-extern font-set-tex0 (function (pointer gs-tex0) texture int int int none)) +(define-extern set-font-color (function font-color int rgba rgba rgba int)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; decomp-h ;; @@ -8031,8 +8093,8 @@ ;; profile ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype profile-work (structure) + "DMA templates for profile drawing." ((sprite-tmpl dma-gif-packet :inline :offset-assert 0) (line-tmpl dma-gif-packet :inline :offset-assert 32) (last-index int32 :offset-assert 64) @@ -8041,40 +8103,47 @@ :size-assert #x44 :flag-assert #x900000044 ) -|# -;; (define-extern *profile-spec-array* object) -;; (define-extern *profile-translate-array* object) -;; (define-extern *profile-work* object) ;; profile-work -;; (define-extern *profile-x* object) ;; int -;; (define-extern *profile-y* object) ;; int -;; (define-extern *profile-w* object) ;; int -;; (define-extern *profile-h* object) ;; int -;; (define-extern *profile-ticks* object) ;; symbol +(define-extern *profile-spec-array* (inline-array profile-spec)) +(define-extern *profile-translate-array* (pointer uint64)) +(define-extern *profile-work* profile-work) +(define-extern *profile-x* int) +(define-extern *profile-y* int) +(define-extern *profile-w* int) +(define-extern *profile-h* int) +(define-extern *profile-ticks* symbol) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; display ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -(define-extern get-current-time (function time-frame)) -(define-extern get-integral-current-time (function time-frame)) +(define-extern get-current-time "Get the base-clock time." (function time-frame)) +(define-extern get-integral-current-time "Get the number of frames that have happened." (function time-frame)) (define-extern get-real-current-time (function time-frame)) -(define-extern set-display (function display 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) ;; (function dma-buffer int int int int rgba none) -;; (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 int 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 display) -;; (define-extern *vu0-dma-list* object) ;; dma-buffer +(define-extern set-display "Allocate and initialize clocks for the display." (function display display)) +(define-extern allocate-dma-buffers "Allocate the main, debug, and calc dma buffers." (function display display)) +(define-extern *font-context* font-context) +(define-extern draw-sprite2d-xy "Draw a sprite primitive with the given color and dimensions." (function dma-buffer int int int int rgba int none)) +(define-extern draw-sprite2d-xy-absolute + "Draw a sprite primitive, setting the gs-xzyf register to exactly the values specified (no offset/clamp)." + (function dma-buffer int int int int rgba int none)) +(define-extern draw-quad2d "Draw a quad that fills the entire context." (function dma-buffer draw-context none)) +(define-extern screen-gradient "Fill the screen with a sprite with the given colors." (function dma-buffer rgba rgba rgba rgba none)) +(define-extern vif1-handler-debug + "Handle the VIF1 interrupt. + The mark register of VIF will be set to the bucket that is now starting." + (function int none)) +(define-extern vif1-handler (function none)) +(define-extern vblank-handler "Record the time of the last two vblanks." (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 display)) +(define-extern *vu0-dma-list* dma-buffer) (define-extern *display* display) +;; from kernel +(define-extern install-handler (function int function int)) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; connect ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -9167,7 +9236,6 @@ ) ;; ---text-h:text-id -#| (deftype game-text (structure) ((id text-id :offset-assert 0) ;; guessed by decompiler (text string :offset-assert 4) ;; guessed by decompiler @@ -9176,9 +9244,7 @@ :size-assert #x8 :flag-assert #x900000008 ) -|# -#| (deftype game-text-info (basic) ((length int32 :offset-assert 4) (language-id int32 :offset-assert 8) @@ -9189,39 +9255,35 @@ :size-assert #x10 :flag-assert #xa00000010 (:methods - (game-text-info-method-9 () none) ;; 9 ;; (lookup-text! (_type_ text-id symbol) string) + (lookup-text! (_type_ 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) @@ -9236,10 +9298,9 @@ :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 ;; @@ -9718,15 +9779,19 @@ ;; settings-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +++settings-h:game-feature (defenum game-feature :type uint64 :bitfield #t ) +;; ---settings-h:game-feature +;; +++settings-h:game-secrets (defenum game-secrets :type uint64 :bitfield #t ) +;; ---settings-h:game-secrets (deftype user-setting-data (structure) ((border-mode symbol :offset-assert 0) ;; guessed by decompiler @@ -9849,13 +9914,62 @@ ) ) -#| +;; +++settings-h:cam-slave-options +(defenum cam-slave-options + :type uint64 + :bitfield #t + (BUTT_CAM) + (SAME_SIDE) + (MOVE_SPHERICAL) + (ALLOW_Z_ROT) + (JUMP_PITCHES) + (COLLIDE) + (FIND_HIDDEN_TARGET) + (DRAG) + (PLAYER_MOVING_CAMERA) + (LINE_OF_SIGHT) + (MOVEMENT_BLOCKED) + (SHRINK_MAX_ANGLE) + (GOTO_GOOD_POINT) + (BIKE_MODE) + (NO_ROTATE) + (STICKY_ANGLE) + (BLOCK_RIGHT_STICK) + (ALLOW_SHIFT_BUTTONS) + (GUN_CAM) + (WIDE_FOV) + (RAPID_TRACKING) + (EASE_SPLINE_IDX) + (VERTICAL_FOLLOW_MATCHES_CAMERA) + (HAVE_BUTT_HANDLE) + (BOMBBOT) + (JUMP_LAG) + ) +;; ---settings-h:cam-slave-options + +;; +++settings-h:cam-master-options +(defenum cam-master-options + :type uint64 + :bitfield #t + (HAVE_TARGET) ;; 1 + (SET_COMBINER_AXIS) ;; 2 + (FLIP_COMBINER) ;; 4 + (HAVE_EASE_TO_POS) ;; 8 + (IN_BASE_REGION) ;; 10 + (IGNORE_ANALOG) ;; 20 + (BLOCK_RIGHT_STICK) ;; 40 + (USE_L1_R1) ;; 80 + (READ_BUTTONS) + (IMMEDIATE_STRING_MIN_MAX) + ) +;; ---settings-h:cam-master-options + (deftype cam-setting-data (structure) - ((fov deg :offset-assert 0) ;; degrees - (pov-handle uint64 :offset-assert 16) ;; handle + ((fov degrees :offset-assert 0) ;; degrees + (pov-handle handle :offset 16) ;; handle (pov-bone int32 :offset-assert 24) (pov-offset vector :inline :offset-assert 32) - (string-default boolean :offset-assert 48) ;; symbol + (string-default symbol :offset-assert 48) ;; symbol (string-max-length meters :offset-assert 52) (string-min-length meters :offset-assert 56) (string-max-height meters :offset-assert 60) @@ -9867,23 +9981,23 @@ (gun-min-height meters :offset-assert 84) (string-local-down vector :inline :offset-assert 96) (slave-options cam-slave-options :offset-assert 112) - (matrix-blend-max-angle deg :offset-assert 120) ;; degrees + (matrix-blend-max-angle degrees :offset-assert 120) ;; degrees (matrix-blend-max-partial float :offset-assert 124) (string-spline-max-move meters :offset-assert 128) (string-spline-accel meters :offset-assert 132) (string-spline-max-move-player meters :offset-assert 136) (string-spline-accel-player meters :offset-assert 140) (string-startup-vector vector :inline :offset-assert 144) - (use-string-startup-vector basic :offset-assert 160) + (use-string-startup-vector symbol :offset-assert 160) (look-at-point vector :inline :offset-assert 176) (use-look-at-point symbol :offset-assert 192) ;; guessed by decompiler (target-height meters :offset-assert 196) (foot-offset meters :offset-assert 200) (head-offset meters :offset-assert 204) - (teleport-on-entity-change boolean :offset-assert 208) ;; symbol + (teleport-on-entity-change symbol :offset-assert 208) ;; symbol (entity-name string :offset-assert 212) (cam-slope string :offset-assert 216) - (entity-or-mode-changed boolean :offset-assert 220) ;; symbol + (entity-or-mode-changed symbol :offset-assert 220) ;; symbol (master-options cam-master-options :offset-assert 224) (entity-mask uint32 :offset-assert 232) (mode-name symbol :offset-assert 236) ;; guessed by decompiler @@ -9893,12 +10007,12 @@ (no-intro symbol :offset-assert 252) ;; guessed by decompiler (use-point-of-interest symbol :offset-assert 256) ;; guessed by decompiler (point-of-interest vector :inline :offset-assert 272) - (handle-of-interest uint64 :offset-assert 288) ;; handle + (handle-of-interest handle :offset-assert 288) ;; handle (mouse-tumble-point vector :inline :offset-assert 304) (use-mouse-tumble-point symbol :offset-assert 320) ;; guessed by decompiler (mouse-input symbol :offset-assert 324) ;; guessed by decompiler (cpad1-skip-buttons symbol :offset-assert 328) ;; guessed by decompiler - (butt-handle uint64 :offset-assert 336) ;; handle + (butt-handle handle :offset-assert 336) ;; handle (butt-angle float :offset-assert 344) (extra-follow-height float :offset-assert 348) (interp-time-priority uint32 :offset-assert 352) @@ -9906,9 +10020,9 @@ (string-min-length-default symbol :offset-assert 360) ;; guessed by decompiler (string-max-height-default symbol :offset-assert 364) ;; guessed by decompiler (string-min-height-default symbol :offset-assert 368) ;; guessed by decompiler - (flip-vertical basic :offset-assert 372) - (flip-horizontal basic :offset-assert 376) - (fov-priority float :offset-assert 384) + (flip-vertical symbol :offset-assert 372) + (flip-horizontal symbol :offset-assert 376) + (fov-priority float :offset 384) (dummy object 98 :offset-assert 388) ;; guessed by decompiler ) :method-count-assert 11 @@ -9916,13 +10030,11 @@ :flag-assert #xb0000030c ;; field cam-slave-options is likely a value type. field cam-master-options is likely a value type. (:methods - (cam-setting-data-method-9 () none) ;; 9 ;; (cam-setting-data-method-9 (_type_ engine engine-pers engine) _type_) - (cam-setting-data-method-10 () none) ;; 10 ;; (cam-setting-data-method-10 (_type_ object (pointer process) float int) _type_) + (cam-setting-data-method-9 (_type_ engine engine-pers engine) _type_) ;; 9 + (cam-setting-data-method-10 (_type_ object (pointer process) float int) _type_) ;; 10 ) ) -|# -#| (deftype setting-control (basic) ((user-current user-setting-data :inline :offset-assert 16) (user-target user-setting-data :inline :offset-assert 928) @@ -9933,9 +10045,9 @@ (engine engine :offset-assert 5100) ;; guessed by decompiler (engine-pers engine-pers :offset-assert 5104) ;; guessed by decompiler (engine-hi engine :offset-assert 5108) ;; guessed by decompiler - (sound-stinger-time uint64 :offset-assert 5112) ;; time-frame + (sound-stinger-time time-frame :offset-assert 5112) ;; time-frame (sound-stinger-change-time time-frame 4 :offset-assert 5120) ;; guessed by decompiler - (sound-excitement-change-time uint64 :offset-assert 5152) ;; time-frame + (sound-excitement-change-time time-frame :offset-assert 5152) ;; time-frame (sound-excitement-targ float :offset-assert 5160) (sound-excitement-level uint32 :offset-assert 5164) ) @@ -9943,21 +10055,20 @@ :size-assert #x1430 :flag-assert #x1400001430 (:methods - (new (symbol type) _type_) ;; 0 ;; (new (symbol type int) _type_) - (setting-control-method-9 () none) ;; 9 ;; (add-setting (_type_ process symbol object object object) none) - (setting-control-method-10 () none) ;; 10 ;; (persist-with-delay (_type_ symbol time-frame symbol symbol float int) none) - (setting-control-method-11 () none) ;; 11 ;; (set-setting (_type_ process symbol object object object) none) - (setting-control-method-12 () none) ;; 12 ;; (remove-setting (_type_ process symbol) none) - (setting-control-method-13 () none) ;; 13 ;; (kill-persister (_type_ engine-pers object) none) - (setting-control-method-14 () none) ;; 14 ;; (setting-control-method-14 (_type_ object) connectable) - (setting-control-method-15 () none) ;; 15 ;; (remove-setting-by-arg0 (_type_ object) none) - (setting-control-method-16 () none) ;; 16 ;; (set-setting-by-param (_type_ symbol object object object) connection) + (new (symbol type int) _type_) ;; 0 + (add-setting (_type_ process symbol object object object) none) ;; 9 + (persist-with-delay (_type_ symbol time-frame symbol symbol float int) none) ;; 10 + (set-setting (_type_ process symbol object object object) none) ;; 11 + (remove-setting (_type_ process symbol) none) ;; 12 + (kill-persister (_type_ engine-pers object) none) ;; 13 + (setting-control-method-14 (_type_ object) connectable) ;; 14 + (remove-setting-by-arg0 (_type_ object) none) ;; 15 + (set-setting-by-param (_type_ symbol object object object) connection) ;; 16 (setting-control-method-17 () none) ;; 17 ;; (apply-settings (_type_) user-setting-data) (setting-control-method-18 () none) ;; 18 ;; (update (_type_) user-setting-data) (setting-control-method-19 () none) ;; 19 ) ) -|# ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -11155,7 +11266,7 @@ ;; (define-extern *subdivide-foreground-draw-mode* object) ;; subdivide-setting ;; (define-extern *subdivide-ocean-draw-mode* object) ;; subdivide-setting ;; (define-extern *ocean-height-hack* object) ;; ocean-height-hack -;; (define-extern *dproc* object) ;; process +(define-extern *dproc* process) ;; (define-extern *run* object) ;; symbol ;; (define-extern *teleport* object) ;; symbol ;; (define-extern *teleport-count* object) ;; int @@ -26871,10 +26982,15 @@ ;; font ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(deftype draw-string-result (uint64) + ((length float :offset 0) + (b float :offset 32)) + ) + ;; (define-extern draw-string-asm function) ;; (function string dma-buffer font-context draw-string-result) ;; (define-extern draw-string function) ;; (function string dma-buffer font-context draw-string-result) ;; (define-extern get-string-length function) ;; (function string font-context draw-string-result) -;; (define-extern draw-string-xy function) ;; (function string dma-buffer int int font-color font-flags draw-string-result) +(define-extern draw-string-xy (function string dma-buffer int int font-color font-flags draw-string-result)) ;; (define-extern draw-string-adv function) ;; (function string dma-buffer font-context none) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -33802,7 +33918,7 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; (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) ;; (function symbol none) @@ -33818,8 +33934,8 @@ ;; (define-extern set-blackout-frames function) ;; (function time-frame none) ;; (define-extern blackout function) ;; (function none) ;; (define-extern add-blackout function) -;; (define-extern paused? function) ;; (function symbol) -;; (define-extern movie? function) ;; (function symbol) +(define-extern paused? (function symbol)) +(define-extern movie? (function symbol)) ;; (define-extern scene-select? function) ;; (define-extern demo? function) ;; (function symbol) ;; (define-extern kiosk? function) diff --git a/decompiler/config/jak3/ntsc_v1/anonymous_function_types.jsonc b/decompiler/config/jak3/ntsc_v1/anonymous_function_types.jsonc index 9ee598fe4a..4282bfae76 100644 --- a/decompiler/config/jak3/ntsc_v1/anonymous_function_types.jsonc +++ b/decompiler/config/jak3/ntsc_v1/anonymous_function_types.jsonc @@ -7,5 +7,8 @@ [32, "(function process symbol)"], [34, "(function process symbol)"], [36, "(function process symbol)"] + ], + "profile": [ + [3, "(function profile-segment-array profile-collapse none)"] ] } diff --git a/decompiler/config/jak3/ntsc_v1/label_types.jsonc b/decompiler/config/jak3/ntsc_v1/label_types.jsonc index e04751dad1..bd1394f6e8 100644 --- a/decompiler/config/jak3/ntsc_v1/label_types.jsonc +++ b/decompiler/config/jak3/ntsc_v1/label_types.jsonc @@ -34,5 +34,9 @@ ["L1043", "uint64", true], ["L1046", "uint64", true], ["L1044", "uint64", true] + ], + "profile": [ + ["L3", "(inline-array profile-spec)", 14], + ["L2", "(pointer uint64)", 584] ] } diff --git a/decompiler/config/jak3/ntsc_v1/type_casts.jsonc b/decompiler/config/jak3/ntsc_v1/type_casts.jsonc index 1a5706bf3c..592931fdc1 100644 --- a/decompiler/config/jak3/ntsc_v1/type_casts.jsonc +++ b/decompiler/config/jak3/ntsc_v1/type_casts.jsonc @@ -150,5 +150,52 @@ ], "(method 9 connection)": [[8, "a0", "pointer"]], "(method 10 connection)": [[8, "a0", "pointer"]], - "(method 11 connection)": [[5, "a1", "pointer"]] + "(method 11 connection)": [[5, "a1", "pointer"]], + "(method 10 profile-array)": [ + [[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, 40], "t0", "dma-packet"], + [[45, 49], "t0", "gs-gif-tag"], + [54, "t0", "(pointer gs-prim)"], + [56, "t0", "(pointer gs-rgbaq)"], + [67, "t0", "(pointer gs-xyzf)"], + [88, "t0", "(pointer gs-xyzf)"], + [[97, 109], "v1", "(pointer uint64)"] + ], + "draw-sprite2d-xy-absolute": [ + [[6, 10], "t4", "dma-packet"], + [[16, 19], "t4", "gs-gif-tag"], + [24, "t4", "(pointer gs-prim)"], + [25, "t4", "(pointer gs-rgbaq)"], + [36, "t4", "(pointer gs-xyzf)"], + [49, "t4", "(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)"] + ] } diff --git a/goal_src/jak3/engine/camera/camera-defs-h.gc b/goal_src/jak3/engine/camera/camera-defs-h.gc index 0a1e5e100a..bd748888e4 100644 --- a/goal_src/jak3/engine/camera/camera-defs-h.gc +++ b/goal_src/jak3/engine/camera/camera-defs-h.gc @@ -7,3 +7,55 @@ ;; DECOMP BEGINS +(deftype camera-bank (basic) + ((collide-move-rad float) + (joypad uint32) + (min-detectable-velocity float) + (attack-timeout time-frame) + (default-string-max-y meters) + (default-string-min-y meters) + (default-string-max-z meters) + (default-string-min-z meters) + (default-string-push-z meters) + (default-tilt-adjust degrees) + ) + ) + + +(define *CAMERA-bank* (new 'static 'camera-bank + :collide-move-rad 1638.4 + :min-detectable-velocity 40.96 + :attack-timeout (seconds 0.25) + :default-string-max-y (meters 3) + :default-string-min-y (meters 1) + :default-string-max-z (meters 12.5) + :default-string-min-z (meters 5) + :default-string-push-z (meters 10) + :default-tilt-adjust (degrees -6.5000005) + ) + ) + +(deftype camera-master-bank (basic) + ((onscreen-head-height meters) + (onscreen-foot-height meters) + (target-height meters) + (up-move-to-pitch-ratio-in-air float) + (down-move-to-pitch-ratio-in-air float) + (up-move-to-pitch-on-ground float) + (down-move-to-pitch-on-ground float) + (pitch-off-blend float) + ) + ) + + +(define *CAMERA_MASTER-bank* (new 'static 'camera-master-bank + :onscreen-head-height (meters 2.65) + :onscreen-foot-height (meters -0.5) + :target-height (meters 2.15) + :up-move-to-pitch-ratio-in-air 1.0 + :down-move-to-pitch-ratio-in-air 0.5 + :up-move-to-pitch-on-ground 0.9 + :down-move-to-pitch-on-ground 0.9 + :pitch-off-blend 0.5 + ) + ) diff --git a/goal_src/jak3/engine/dma/dma-buffer.gc b/goal_src/jak3/engine/dma/dma-buffer.gc index 6327777f2a..95e14598ec 100644 --- a/goal_src/jak3/engine/dma/dma-buffer.gc +++ b/goal_src/jak3/engine/dma/dma-buffer.gc @@ -5,5 +5,298 @@ ;; name in dgo: dma-buffer ;; dgos: GAME +(defmacro gs-reg-list (&rest reg-ids) + "Generate a giftag register descriptor list from reg-ids." + + (let ((reg-count (length reg-ids))) + (when (> (length reg-ids) 16) + (ferror "too many regs passed to gs-reg-list") + ) + (let ((list-to-splice '()) + (cur-lst reg-ids) + (i -1)) + + ;; this is questionable. + (while (and (not (null? cur-lst)) (< i 15)) + (push! list-to-splice (cons 'gif-reg-id (cons (car cur-lst) '()))) + (push! list-to-splice (string->symbol-format ":regs{}" (inc! i))) + (pop! cur-lst) + ) + + `(new 'static 'gif-tag-regs + ,@list-to-splice + ) + ) + #| ;; the opengoal compiler does not have enough constant propagation for this for now + (let ((i -1)) + + `(the-as gif-tag-regs (logior ,@(apply (lambda (x) + `(shl (the-as uint (gif-reg-id ,x)) ,(* 4 (inc! i))) + ) reg-ids) + )) + + )|# + ) + ) + +(defmacro dma-buffer-add-base-type (buf pkt dma-type &rest body) + "Base macro for adding stuff to a dma-buffer. Don't use this directly!" + + (with-gensyms (dma-buf) + `(let* ((,dma-buf ,buf) + (,pkt (the-as ,dma-type (-> ,dma-buf base)))) + + ,@body + + (set! (-> ,dma-buf base) (&+ (the-as pointer ,pkt) (size-of ,dma-type))) + + ) + ) + ) + +(defmacro dma-buffer-add-base-data (buf data-type forms) + "Base macro for adding data words to a dma-buffer. + Each form in forms is converted into data-type and added to the buffer. NO TYPE CHECKING is performed, so be careful!" + + (with-gensyms (dma-buf ptr) + `(let* ((,dma-buf ,buf) + (,ptr (the-as (pointer ,data-type) (-> ,dma-buf base)))) + + ,@(apply-i (lambda (x i) `(set! (-> ,ptr ,i) (the-as ,data-type ,x))) forms) + + (set! (-> ,dma-buf base) (&+ (the-as pointer ,ptr) (* ,(length forms) (size-of ,data-type)))) + + ) + ) + ) + + +(defmacro dma-buffer-add-cnt-vif2 (buf qwc vif0 vif1) + "Add a dma-packet to a dma-buffer. + The packet is made up of a 'cnt' DMAtag (transfer qwc qwords of data after the tag and continue from after that point) + and includes two vif-tags for vifcode, or something else if needed." + + (with-gensyms (pkt) + `(dma-buffer-add-base-type ,buf ,pkt dma-packet + + (set! (-> ,pkt dma) (new 'static 'dma-tag :id (dma-tag-id cnt) :qwc ,qwc)) + + (set! (-> ,pkt vif0) ,vif0) + (set! (-> ,pkt vif1) ,vif1) + + ) + ) + ) + +(defmacro dma-buffer-add-ref-vif2 (buf qwc addr vif0 vif1) + "Add a dma-packet to a dma-buffer. + The packet is made up of a 'cnt' DMAtag (transfer qwc qwords of data at addr and continue from after the tag) + and includes two vif-tags for vifcode, or something else if needed." + + (with-gensyms (pkt) + `(dma-buffer-add-base-type ,buf ,pkt dma-packet + + (set! (-> ,pkt dma) (new 'static 'dma-tag :id (dma-tag-id ref) :qwc ,qwc :addr (the-as int ,addr))) + + (set! (-> ,pkt vif0) ,vif0) + (set! (-> ,pkt vif1) ,vif1) + + ) + ) + ) + +(defmacro dma-buffer-add-ret (buf) + "Add a dma-packet to a dma-buffer. This packet simply does a DMA 'return' " + + (with-gensyms (pkt) + `(dma-buffer-add-base-type ,buf ,pkt dma-packet + + (set! (-> ,pkt dma) (new 'static 'dma-tag :id (dma-tag-id ret) :qwc 0)) + + (set! (-> ,pkt vif0) (new 'static 'vif-tag :cmd (vif-cmd nop))) + (set! (-> ,pkt vif1) (new 'static 'vif-tag :cmd (vif-cmd nop))) + + ) + ) + ) + +(defmacro dma-buffer-add-gif-tag (buf giftag gifregs) + "Add a giftag to a dma-buffer." + + (with-gensyms (pkt) + `(dma-buffer-add-base-type ,buf ,pkt gs-gif-tag + + (set! (-> ,pkt tag) ,giftag) + + (set! (-> ,pkt regs) ,gifregs) + + ) + ) + ) + +(defmacro dma-buffer-add-uint64 (buf &rest body) + "Add 64-bit words to a dma-buffer. See dma-buffer-add-base-data" + + `(dma-buffer-add-base-data ,buf uint64 ,body) + ) + +(defmacro dma-buffer-add-uint128 (buf &rest body) + "Add 128-bit words to a dma-buffer. See dma-buffer-add-base-data" + + `(dma-buffer-add-base-data ,buf uint128 ,body) + ) + +(defmacro dma-buffer-add-gs-set-flusha (buf &rest reg-list) + "Add a gif cnt dma packet to a dma-buffer for setting GS registers. Up to 16 can be set at once. + The packet runs the flusha command which waits for GIF transfer to end and VU1 microprogram to stop. + reg-list is a list of pairs where the car is the register name and the cadr is the value to be set for that register." + + (let ((reg-count (length reg-list)) + (qwc (+ (length reg-list) 1)) + (reg-names (apply first reg-list)) + (reg-datas (apply second reg-list)) + ) + `(begin + ;; dma tag + (dma-buffer-add-cnt-vif2 ,buf ,qwc + (new 'static 'vif-tag :cmd (vif-cmd flusha)) + (new 'static 'vif-tag :cmd (vif-cmd direct) :imm ,qwc) + ) + + ;; gif tag for editing gs regs + (dma-buffer-add-gif-tag ,buf (new 'static 'gif-tag64 :nloop 1 :eop 1 :nreg ,reg-count) + (gs-reg-list a+d a+d a+d a+d a+d a+d a+d a+d a+d a+d a+d a+d a+d a+d a+d a+d) + ) + + ;; gs regs + (dma-buffer-add-uint64 ,buf + ,@(apply2 (lambda (x) x) (lambda (x) `(gs-reg64 ,x)) reg-datas reg-names) + ) + ) + ) + ) + +(defmacro dma-buffer-add-gs-set (buf &rest reg-list) + "Add a gif cnt dma packet to a dma-buffer for setting GS registers. Up to 16 can be set at once. + reg-list is a list of pairs where the car is the register name and the cadr is the value to be set for that register." + + (let ((reg-count (length reg-list)) + (qwc (+ (length reg-list) 1)) + (reg-names (apply first reg-list)) + (reg-datas (apply second reg-list)) + ) + `(begin + ;; dma tag + (dma-buffer-add-cnt-vif2 ,buf ,qwc + (new 'static 'vif-tag :cmd (vif-cmd nop)) + (new 'static 'vif-tag :cmd (vif-cmd direct) :imm ,qwc) + ) + + ;; gif tag for editing gs regs + (dma-buffer-add-gif-tag ,buf (new 'static 'gif-tag64 :nloop 1 :eop 1 :nreg ,reg-count) + (gs-reg-list a+d a+d a+d a+d a+d a+d a+d a+d a+d a+d a+d a+d a+d a+d a+d a+d) + ) + + ;; gs regs + (dma-buffer-add-uint64 ,buf + ,@(apply2 (lambda (x) x) (lambda (x) `(gs-reg64 ,x)) reg-datas reg-names) + ) + ) + ) + ) + +(defmacro with-dma-bucket (bindings &rest body) + "Start a new dma-bucket in body that will be finished at the end. + The bindings are the dma-buffer, dma-bucket and bucket-id respectively." + + (let ((buf (first bindings)) + (bucket (second bindings)) + (bucket-id (third bindings)) + ) + + (with-gensyms (buf-start bucket-edge pkt) + `(let ((,buf-start (-> ,buf base))) + + ,@body + + ;; we end the chain with a next. The bucket system will patch the next chain to this, + ;; and then patch all the buckets togehter before sending the DMA. + (let ((,bucket-edge (the (pointer dma-tag) (-> ,buf base)))) + (let ((,pkt (the-as dma-packet (-> ,buf base)))) + + (set! (-> ,pkt dma) (new 'static 'dma-tag :id (dma-tag-id next))) + (set! (-> ,pkt vif0) (new 'static 'vif-tag :cmd (vif-cmd nop))) + (set! (-> ,pkt vif1) (new 'static 'vif-tag :cmd (vif-cmd nop))) + + (set! (-> ,buf base) (&+ (the-as pointer ,pkt) (size-of dma-packet))) + + ) + (dma-bucket-insert-tag ,bucket ,bucket-id + ,buf-start ;; the first thing in this chain, bucket will patch previous to this + ,bucket-edge ;; end of this chain (ptr to next tag) + ) + ) + ) + ) + + ) + ) + +(defmacro with-dma-buffer-add-bucket (bindings &key (bucket-group (-> (current-frame) bucket-group)) &rest body) + "Bind a dma-buffer to a variable and use it on a block to allow adding things to a new bucket. + usage: (with-dma-buffer-add-bucket ((buffer-name buffer) bucket-id) &rest body) + example: (with-dma-buffer-add-bucket ((buf (-> (current-frame) debug-buf)) (bucket-id debug-no-zbuf)) ...)" + + `(let ((,(caar bindings) ,(cadar bindings))) + (with-dma-bucket (,(caar bindings) ,bucket-group ,(cadr bindings)) + ,@body + ) + ) + ) + ;; DECOMP BEGINS +(deftype dma-packet (structure) + ((dma dma-tag) + (vif0 vif-tag) + (vif1 vif-tag) + (quad uint128 :overlay-at dma) + ) + ) + + +(deftype dma-packet-array (inline-array-class) + ((data dma-packet :dynamic) + ) + ) + + +(set! (-> dma-packet-array heap-base) (the-as uint 16)) + +(deftype dma-gif (structure) + ((gif uint64 2) + (quad uint128 :overlay-at (-> gif 0)) + ) + ) + + +(deftype dma-gif-packet (structure) + ((dma-vif dma-packet :inline) + (gif uint64 2) + (quad uint128 2 :overlay-at (-> dma-vif dma)) + ) + ) + + +(deftype dma-buffer (basic) + ((allocated-length int32) + (base pointer) + (end pointer) + (real-buffer-end int32) + (data uint64 1 :offset 32) + ) + (:methods + (new (symbol type int) _type_) + ) + ) + diff --git a/goal_src/jak3/engine/game/settings-h.gc b/goal_src/jak3/engine/game/settings-h.gc index 265f6a1846..e0212ebdc4 100644 --- a/goal_src/jak3/engine/game/settings-h.gc +++ b/goal_src/jak3/engine/game/settings-h.gc @@ -5,5 +5,303 @@ ;; name in dgo: settings-h ;; dgos: GAME +;; +++cam-master-options +(defenum cam-master-options + :type uint64 + :bitfield #t + (HAVE_TARGET) ;; 1 + (SET_COMBINER_AXIS) ;; 2 + (FLIP_COMBINER) ;; 4 + (HAVE_EASE_TO_POS) ;; 8 + (IN_BASE_REGION) ;; 10 + (IGNORE_ANALOG) ;; 20 + (BLOCK_RIGHT_STICK) ;; 40 + (USE_L1_R1) ;; 80 + (READ_BUTTONS) + (IMMEDIATE_STRING_MIN_MAX) + ) +;; ---cam-master-options + + +;; +++cam-slave-options +(defenum cam-slave-options + :type uint64 + :bitfield #t + (BUTT_CAM) + (SAME_SIDE) + (MOVE_SPHERICAL) + (ALLOW_Z_ROT) + (JUMP_PITCHES) + (COLLIDE) + (FIND_HIDDEN_TARGET) + (DRAG) + (PLAYER_MOVING_CAMERA) + (LINE_OF_SIGHT) + (MOVEMENT_BLOCKED) + (SHRINK_MAX_ANGLE) + (GOTO_GOOD_POINT) + (BIKE_MODE) + (NO_ROTATE) + (STICKY_ANGLE) + (BLOCK_RIGHT_STICK) + (ALLOW_SHIFT_BUTTONS) + (GUN_CAM) + (WIDE_FOV) + (RAPID_TRACKING) + (EASE_SPLINE_IDX) + (VERTICAL_FOLLOW_MATCHES_CAMERA) + (HAVE_BUTT_HANDLE) + (BOMBBOT) + (JUMP_LAG) + ) +;; ---cam-slave-options + + +;; +++game-feature +(defenum game-feature + :type uint64 + :bitfield #t + ) +;; ---game-feature + + +;; +++game-secrets +(defenum game-secrets + :type uint64 + :bitfield #t + ) +;; ---game-secrets + + ;; DECOMP BEGINS +(deftype user-setting-data (structure) + ((border-mode symbol) + (process-mask process-mask) + (unknown-int32 int32) + (language language-enum) + (movie (pointer process) :offset 32) + (talking (pointer process)) + (spooling (pointer process)) + (hint (pointer process)) + (ambient (pointer process)) + (video-mode symbol) + (aspect-ratio symbol) + (auto-save symbol :offset 64) + (bg-r float) + (bg-g float) + (bg-b float) + (bg-a float) + (bg-a-speed float) + (bg-a-force float) + (blur-a float) + (blur-a-speed float) + (allow-progress symbol) + (allow-pause symbol) + (movie-name symbol :offset 120) + (weather symbol) + (task-mask task-mask :offset 140) + (duck symbol :offset 148) + (attack symbol) + (gun symbol) + (board symbol) + (jump symbol) + (speed-mult float) + (features uint64) + (vehicles uint64) + (sfx-volume float) + (sfx-volume-movie float) + (music-volume float) + (music-volume-movie float) + (dialog-volume float) + (dialog-volume-talker float) + (ambient-volume float) + (ambient-volume-movie float) + (dynamic-ambient-volume float) + (talker-volume float) + (sound-flava uint8) + (sound-flava-priority float) + (mode-sound-bank uint32) + (sound-excitement float) + (sound-reverb float) + (stereo-mode int32) + (music symbol) + (sound-stinger int32) + (spool-anim spool-anim) + (sound-mode uint32) + (task-manager (pointer process)) + (task symbol) + (airlock symbol) + (minimap uint32) + (sound-tune uint32) + (allow-continue symbol) + (subtitle symbol :offset 304) + (doorway symbol) + (gem symbol) + (half-speed symbol) + (gun-buoy symbol) + (double-jump symbol) + (pilot symbol) + (pilot-exit symbol) + (pilot-death basic) + (speech-control symbol) + (vehicle-hijacking symbol) + (darkjak symbol) + (lightjak basic) + (endlessfall symbol) + (rain float) + (snow float) + (exclusive-load symbol) + (render symbol) + (allow-timeout symbol) + (mirror symbol) + (movie-skip-frame float) + (allow-blackout symbol) + (race-minimap int32) + (beard symbol) + (ignore-target symbol) + (subtitle-language uint8) + (sound-bank-load symbol) + (allow-error symbol) + (under-water-pitch-mod float) + (slow-time float) + (restart-info basic :offset 428) + (fail-info basic) + (death-info basic) + (quit-info basic) + (extra-bank-count uint32) + (extra-bank pair 3) + (borrow-count uint32) + (borrow pair 3) + (exclusive-task-count uint32) + (exclusive-task int32 3) + (level-trans-time int32) + (scarf float) + (goggles float) + (board-trail basic) + (letterbox float :offset 572) + (letterbox-speed float) + (borrow-city-count uint32 :offset 620) + (borrow-city pair 3) + (audio-language language-enum :offset 748) + (special-volume float :offset 796) + (pad uint8 108 :offset 800) + ) + (:methods + (user-setting-data-method-9 (_type_ engine engine-pers engine) user-setting-data) + (user-setting-data-method-10 (_type_ object symbol float uint) user-setting-data) + ) + ) + + +(deftype cam-setting-data (structure) + ((fov degrees) + (pov-handle handle :offset 16) + (pov-bone int32) + (pov-offset vector :inline) + (string-default symbol) + (string-max-length meters) + (string-min-length meters) + (string-max-height meters) + (string-min-height meters) + (string-cliff-height meters) + (string-camera-floor meters) + (string-camera-ceiling meters) + (gun-max-height meters) + (gun-min-height meters) + (string-local-down vector :inline) + (slave-options cam-slave-options) + (matrix-blend-max-angle degrees) + (matrix-blend-max-partial float) + (string-spline-max-move meters) + (string-spline-accel meters) + (string-spline-max-move-player meters) + (string-spline-accel-player meters) + (string-startup-vector vector :inline) + (use-string-startup-vector symbol) + (look-at-point vector :inline) + (use-look-at-point symbol) + (target-height meters) + (foot-offset meters) + (head-offset meters) + (teleport-on-entity-change symbol) + (entity-name string) + (cam-slope string) + (entity-or-mode-changed symbol) + (master-options cam-master-options) + (entity-mask uint32) + (mode-name symbol) + (real-entity-name string) + (cam-mode symbol) + (interp-time uint32) + (no-intro symbol) + (use-point-of-interest symbol) + (point-of-interest vector :inline) + (handle-of-interest handle) + (mouse-tumble-point vector :inline) + (use-mouse-tumble-point symbol) + (mouse-input symbol) + (cpad1-skip-buttons symbol) + (butt-handle handle) + (butt-angle float) + (extra-follow-height float) + (interp-time-priority uint32) + (string-max-length-default symbol) + (string-min-length-default symbol) + (string-max-height-default symbol) + (string-min-height-default symbol) + (flip-vertical symbol) + (flip-horizontal symbol) + (fov-priority float :offset 384) + (dummy object 98) + ) + (:methods + (cam-setting-data-method-9 (_type_ engine engine-pers engine) _type_) + (cam-setting-data-method-10 (_type_ object (pointer process) float int) _type_) + ) + ) + + +(deftype setting-control (basic) + ((user-current user-setting-data :inline) + (user-target user-setting-data :inline) + (user-default user-setting-data :inline) + (cam-current cam-setting-data :inline) + (cam-target cam-setting-data :inline) + (cam-default cam-setting-data :inline) + (engine engine) + (engine-pers engine-pers) + (engine-hi engine) + (sound-stinger-time time-frame) + (sound-stinger-change-time time-frame 4) + (sound-excitement-change-time time-frame) + (sound-excitement-targ float) + (sound-excitement-level uint32) + ) + (:methods + (new (symbol type int) _type_) + (add-setting (_type_ process symbol object object object) none) + (persist-with-delay (_type_ symbol time-frame symbol symbol float int) none) + (set-setting (_type_ process symbol object object object) none) + (remove-setting (_type_ process symbol) none) + (kill-persister (_type_ engine-pers object) none) + (setting-control-method-14 (_type_ object) connectable) + (remove-setting-by-arg0 (_type_ object) none) + (set-setting-by-param (_type_ symbol object object object) connection) + (setting-control-method-17 () none) + (setting-control-method-18 () none) + (setting-control-method-19 () none) + ) + ) + + +(defmethod new setting-control ((allocation symbol) (type-to-make type) (arg0 int)) + (let ((s4-0 (object-new allocation type-to-make (the-as int (-> type-to-make size))))) + (set! (-> s4-0 engine) ((method-of-type engine new) allocation engine 'setting-control arg0 connection)) + (set! (-> s4-0 engine-hi) ((method-of-type engine new) allocation engine 'setting-control arg0 connection)) + (set! (-> s4-0 engine-pers) + ((method-of-type engine-pers new) allocation engine-pers 'setting-control arg0 connection-pers) + ) + s4-0 + ) + ) diff --git a/goal_src/jak3/engine/gfx/font-h.gc b/goal_src/jak3/engine/gfx/font-h.gc index c525b5e83a..72ee36ae86 100644 --- a/goal_src/jak3/engine/gfx/font-h.gc +++ b/goal_src/jak3/engine/gfx/font-h.gc @@ -5,5 +5,726 @@ ;; name in dgo: font-h ;; dgos: GAME +;; +++font-flags +(defenum font-flags + :type uint32 + :bitfield #t + (shadow 0) + (kerning 1) + (middle 2) + (middle-vert 3) + (right 4) + (large 5) + (pc-hack 6) + ) +;; ---font-flags + + +;; +++font-color +(defenum font-color + :type uint32 + (default 0) + (white 1) + (transparent 2) + (red 3) + (orange 4) + (yellow 5) + (green 6) + (blue 7) + (cyan 8) + (pink 9) + (menu-selected 10) + (menu-selected-parent 11) + (menu 12) + (menu-parent 13) + (menu-func-bad 14) + (menu-flag-on 15) + (menu-flag-on-parent 16) + (menu-flag-off 17) + (menu-flag-off-parent 18) + (menu-invalid 19) + (flat-yellow 20) + (font-color-21 21) + (pad-back 22) + (pad-shine 23) + (pad-square 24) + (pad-circle 25) + (pad-triangle 26) + (pad-x 27) + (progress-old-blue 28) + (progress-old-yellow 29) + (progress-old-selected 30) + (progress-old-percent 31) + (font-color-32 32) + (font-color-33 33) + (font-color-34 34) + (font-color-35 35) + (font-color-36 36) + (font-color-37 37) + (font-color-38 38) + (font-color-39 39) + (font-color-40 40) + (font-color-41 41) + (font-color-42 42) + (font-color-43 43) + (font-color-44 44) + ) +;; ---font-color + + +;; added type +(deftype draw-string-result (uint64) + ((length float :offset 0) + (b float :offset 32)) + ) + +(define-extern draw-string-xy (function string dma-buffer int int font-color font-flags draw-string-result)) + ;; DECOMP BEGINS +(deftype char-verts (structure) + ((pos vector 4 :inline) + (color vector 4 :inline) + (tex-st vector 4 :inline) + ) + ) + + +(deftype char-color (structure) + ((color rgba 4) + ) + ) + + +(define *font-default-matrix* (new 'static 'matrix + :rvec (new 'static 'vector :x 1.0) + :uvec (new 'static 'vector :y 1.0) + :fvec (new 'static 'vector :z 1.0) + :trans (new 'static 'vector :x -256.0 :y -208.0 :w 1.0) + ) + ) + +(deftype font-context (basic) + ((origin vector :inline) + (strip-gif vector :inline) + (width float) + (height float) + (projection float) + (scale float) + (color font-color) + (flags font-flags) + (mat matrix) + (start-line uint32) + (alpha float) + (max-x float) + ) + (:methods + (new (symbol type matrix int int float font-color font-flags) _type_) + (set-mat! (font-context matrix) font-context) + (set-origin! (font-context int int) font-context) + (set-depth! (font-context int) font-context) + (set-w! (font-context float) font-context) + (set-width! (font-context int) font-context) + (set-height! (font-context int) font-context) + (set-projection! (font-context float) font-context) + (set-color! (font-context font-color) font-context) + (set-flags! (font-context font-flags) font-context) + (set-start-line! (font-context uint) font-context) + (set-scale! (font-context float) font-context) + (set-alpha! (font-context float) font-context) + ) + ) + + +(defmethod set-mat! ((this font-context) (arg0 matrix)) + (set! (-> this mat) arg0) + this + ) + +(defmethod set-origin! ((this font-context) (arg0 int) (arg1 int)) + (set! (-> this origin x) (the float arg0)) + (set! (-> this origin y) (the float arg1)) + this + ) + +(defmethod set-depth! ((this font-context) (arg0 int)) + (set! (-> this origin z) (the float arg0)) + this + ) + +(defmethod set-w! ((this font-context) (arg0 float)) + (set! (-> this origin w) arg0) + this + ) + +(defmethod set-width! ((this font-context) (arg0 int)) + (set! (-> this width) (the float arg0)) + this + ) + +(defmethod set-height! ((this font-context) (arg0 int)) + (set! (-> this height) (the float arg0)) + this + ) + +(defmethod set-projection! ((this font-context) (arg0 float)) + (set! (-> this projection) arg0) + this + ) + +(defmethod set-color! ((this font-context) (arg0 font-color)) + (set! (-> this color) arg0) + this + ) + +(defmethod set-flags! ((this font-context) (arg0 font-flags)) + (set! (-> this flags) arg0) + this + ) + +(defmethod set-start-line! ((this font-context) (arg0 uint)) + (set! (-> this start-line) arg0) + this + ) + +(defmethod set-scale! ((this font-context) (arg0 float)) + (set! (-> this scale) arg0) + this + ) + +(defmethod set-alpha! ((this font-context) (arg0 float)) + (set! (-> this alpha) arg0) + this + ) + +(defmethod new font-context ((allocation symbol) + (type-to-make type) + (arg0 matrix) + (arg1 int) + (arg2 int) + (arg3 float) + (arg4 font-color) + (arg5 font-flags) + ) + (let ((v0-0 (object-new allocation type-to-make (the-as int (-> type-to-make size))))) + (set! (-> v0-0 mat) arg0) + (let ((v1-3 v0-0)) + (set! (-> v1-3 origin x) (the float arg1)) + (set! (-> v1-3 origin y) (the float arg2)) + ) + (cond + ((= arg3 0.0) + (let ((v1-4 v0-0)) + (set! (-> v1-4 origin z) (-> *math-camera* isometric trans z)) + ) + ) + (else + (let ((v1-5 v0-0)) + (set! (-> v1-5 origin z) arg3) + ) + ) + ) + (let ((v1-6 v0-0)) + (set! (-> v1-6 origin w) 1.0) + ) + (let ((v1-7 v0-0)) + (set! (-> v1-7 width) (the float 512)) + ) + (let ((v1-8 v0-0)) + (set! (-> v1-8 height) (the float 416)) + ) + (let ((v1-9 v0-0)) + (set! (-> v1-9 projection) 1.0) + ) + (set! (-> v0-0 color) arg4) + (set! (-> v0-0 flags) arg5) + (let ((a0-6 v0-0)) + (set! (-> a0-6 start-line) (the-as uint 0)) + ) + (let ((v1-13 v0-0)) + (set! (-> v1-13 scale) 1.0) + ) + (let ((v1-14 v0-0)) + (set! (-> v1-14 alpha) 1.0) + ) + v0-0 + ) + ) + +(deftype font-work (structure) + ((font-tmpl dma-gif-packet :inline) + (char-tmpl dma-gif-packet :inline) + (tex1-tmpl uint64 2) + (small-font-0-tmpl uint64 2) + (small-font-1-tmpl uint64 2) + (small-font-2-tmpl uint64 2) + (small-font-3-tmpl uint64 2) + (large-font-0-tmpl uint64 2) + (large-font-1-tmpl uint64 2) + (large-font-2-tmpl uint64 2) + (large-font-3-tmpl uint64 2) + (size1-small vector :inline) + (size2-small vector :inline) + (size3-small vector :inline) + (size1-large vector :inline) + (size2-large-0 vector :inline) + (size2-large-1 vector :inline) + (size2-large-2 vector :inline) + (size2-large-3 vector :inline) + (size3-large vector :inline) + (size2-0 vector :inline) + (size2-1 vector :inline) + (size2-2 vector :inline) + (size2-3 vector :inline) + (size-st1 vector :inline) + (size-st2 vector :inline) + (size-st3 vector :inline) + (save vector :inline) + (save-color vector 4 :inline) + (character-save-color vector 4 :inline) + (current-verts char-verts :inline) + (src-verts char-verts :inline) + (dest-verts char-verts :inline) + (justify vector 64 :inline) + (color-shadow vector4w :inline) + (color-table char-color 45 :inline) + (current-font-0-tmpl uint64 2) + (current-font-1-tmpl uint64 2) + (current-font-2-tmpl uint64 2) + (current-font-3-tmpl uint64 2) + (last-color font-color) + (save-last-color font-color) + (character-save-last-color uint32) + (buf basic) + (str-ptr uint32) + (flags font-flags) + (reg-save uint32 5) + ) + (:methods + (font-work-method-9 () none) + ) + ) + + +(define *font-work* + (new 'static 'font-work + :font-tmpl (new 'static 'dma-gif-packet + :dma-vif (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x2 :id (dma-tag-id cnt)) + :vif1 (new 'static 'vif-tag :imm #x2 :cmd (vif-cmd direct) :msk #x1) + ) + :gif (new 'static 'array uint64 2 #x102e400000008001 #xe) + ) + :char-tmpl (new 'static 'dma-gif-packet + :dma-vif (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #xe :id (dma-tag-id cnt)) + :vif1 (new 'static 'vif-tag :imm #xe :cmd (vif-cmd direct) :msk #x1) + ) + :gif (new 'static 'array uint64 2 #xd02e400000008001 #x412412412412e) + ) + :tex1-tmpl (new 'static 'array uint64 2 #x60 #x14) + :small-font-0-tmpl (new 'static 'array uint64 2 #x0 #x6) + :small-font-1-tmpl (new 'static 'array uint64 2 #x0 #x6) + :small-font-2-tmpl (new 'static 'array uint64 2 #x0 #x6) + :small-font-3-tmpl (new 'static 'array uint64 2 #x0 #x6) + :large-font-0-tmpl (new 'static 'array uint64 2 #x0 #x6) + :large-font-1-tmpl (new 'static 'array uint64 2 #x0 #x6) + :large-font-2-tmpl (new 'static 'array uint64 2 #x0 #x6) + :large-font-3-tmpl (new 'static 'array uint64 2 #x0 #x6) + :size1-small (new 'static 'vector :x 12.0 :w 0.5) + :size2-small (new 'static 'vector :y 14.857 :w 8.0) + :size3-small (new 'static 'vector :x 12.0 :y 14.857 :w 14.857) + :size1-large (new 'static 'vector :x 24.0 :w 1.0) + :size2-large-0 (new 'static 'vector :y 29.714 :w 24.0) + :size2-large-1 (new 'static 'vector :y 29.714 :w 24.0) + :size2-large-2 (new 'static 'vector :y 29.714 :w 24.0) + :size2-large-3 (new 'static 'vector :y 29.714 :w 24.0) + :size3-large (new 'static 'vector :x 24.0 :y 29.714 :w 29.714) + :size-st1 (new 'static 'vector :x 0.08985 :w 0.5) + :size-st2 (new 'static 'vector :y 0.031007752 :w 0.5) + :size-st3 (new 'static 'vector :x 0.08985 :y 0.031007752 :w 0.5) + :current-verts (new 'static 'char-verts + :pos (new 'static 'inline-array vector 4 + (new 'static 'vector :w 1.0) + (new 'static 'vector :w 1.0) + (new 'static 'vector :w 1.0) + (new 'static 'vector :w 1.0) + ) + :tex-st (new 'static 'inline-array vector 4 + (new 'static 'vector :z 1.0) + (new 'static 'vector :z 1.0) + (new 'static 'vector :z 1.0) + (new 'static 'vector :z 1.0) + ) + ) + :src-verts (new 'static 'char-verts + :pos (new 'static 'inline-array vector 4 + (new 'static 'vector :w 1.0) + (new 'static 'vector :w 1.0) + (new 'static 'vector :w 1.0) + (new 'static 'vector :w 1.0) + ) + :tex-st (new 'static 'inline-array vector 4 + (new 'static 'vector :z 1.0) + (new 'static 'vector :z 1.0) + (new 'static 'vector :z 1.0) + (new 'static 'vector :z 1.0) + ) + ) + :dest-verts (new 'static 'char-verts + :pos (new 'static 'inline-array vector 4 + (new 'static 'vector :w 1.0) + (new 'static 'vector :w 1.0) + (new 'static 'vector :w 1.0) + (new 'static 'vector :w 1.0) + ) + :tex-st (new 'static 'inline-array vector 4 + (new 'static 'vector :z 1.0) + (new 'static 'vector :z 1.0) + (new 'static 'vector :z 1.0) + (new 'static 'vector :z 1.0) + ) + ) + :color-shadow (new 'static 'vector4w :w #x80) + :color-table (new 'static 'inline-array char-color 45 + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :r #x70 :g #x78 :b #x70 :a #x80) + (new 'static 'rgba :r #x70 :g #x78 :b #x70 :a #x80) + (new 'static 'rgba :r #x70 :g #x78 :b #x70 :a #x80) + (new 'static 'rgba :r #x70 :g #x78 :b #x70 :a #x80) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x80) + (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x80) + (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x80) + (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x80) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x40) + (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x40) + (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x40) + (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x40) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :r #x80 :g #x20 :a #x80) + (new 'static 'rgba :r #x80 :g #x20 :a #x80) + (new 'static 'rgba :r #x80 :g #x20 :a #x80) + (new 'static 'rgba :r #x80 :g #x20 :a #x80) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :r #x80 :g #x64 :a #x80) + (new 'static 'rgba :r #x80 :g #x64 :a #x80) + (new 'static 'rgba :r #x80 :g #x64 :a #x80) + (new 'static 'rgba :r #x80 :g #x64 :a #x80) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :r #x80 :g #x80 :a #x80) + (new 'static 'rgba :r #x80 :g #x80 :a #x80) + (new 'static 'rgba :r #x80 :g #x80 :a #x80) + (new 'static 'rgba :r #x80 :g #x80 :a #x80) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :r #x20 :g #x80 :b #x20 :a #x80) + (new 'static 'rgba :r #x20 :g #x80 :b #x20 :a #x80) + (new 'static 'rgba :r #x20 :g #x80 :b #x20 :a #x80) + (new 'static 'rgba :r #x20 :g #x80 :b #x20 :a #x80) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :g #x20 :b #x80 :a #x80) + (new 'static 'rgba :g #x20 :b #x80 :a #x80) + (new 'static 'rgba :g #x20 :b #x80 :a #x80) + (new 'static 'rgba :g #x20 :b #x80 :a #x80) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :g #x80 :b #x80 :a #x80) + (new 'static 'rgba :g #x80 :b #x80 :a #x80) + (new 'static 'rgba :g #x80 :b #x80 :a #x80) + (new 'static 'rgba :g #x80 :b #x80 :a #x80) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :r #x80 :g #x40 :b #x80 :a #x80) + (new 'static 'rgba :r #x80 :g #x40 :b #x80 :a #x80) + (new 'static 'rgba :r #x80 :g #x40 :b #x80 :a #x80) + (new 'static 'rgba :r #x80 :g #x40 :b #x80 :a #x80) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :r #x60 :g #x80 :b #x80 :a #x80) + (new 'static 'rgba :r #x60 :g #x80 :b #x80 :a #x80) + (new 'static 'rgba :r #x60 :g #x80 :b #x80 :a #x80) + (new 'static 'rgba :r #x60 :g #x80 :b #x80 :a #x80) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :r #x40 :g #x60 :b #x60 :a #x80) + (new 'static 'rgba :r #x40 :g #x60 :b #x60 :a #x80) + (new 'static 'rgba :r #x40 :g #x60 :b #x60 :a #x80) + (new 'static 'rgba :r #x40 :g #x60 :b #x60 :a #x80) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x80) + (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x80) + (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x80) + (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x80) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :r #x50 :g #x50 :b #x50 :a #x80) + (new 'static 'rgba :r #x50 :g #x50 :b #x50 :a #x80) + (new 'static 'rgba :r #x50 :g #x50 :b #x50 :a #x80) + (new 'static 'rgba :r #x50 :g #x50 :b #x50 :a #x80) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :r #x80 :g #x54 :a #x80) + (new 'static 'rgba :r #x80 :g #x54 :a #x80) + (new 'static 'rgba :r #x80 :g #x54 :a #x80) + (new 'static 'rgba :r #x80 :g #x54 :a #x80) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :r #x70 :g #x80 :b #x30 :a #x80) + (new 'static 'rgba :r #x70 :g #x80 :b #x30 :a #x80) + (new 'static 'rgba :r #x70 :g #x80 :b #x30 :a #x80) + (new 'static 'rgba :r #x70 :g #x80 :b #x30 :a #x80) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :r #x48 :g #x58 :b #x10 :a #x80) + (new 'static 'rgba :r #x48 :g #x58 :b #x10 :a #x80) + (new 'static 'rgba :r #x48 :g #x58 :b #x10 :a #x80) + (new 'static 'rgba :r #x48 :g #x58 :b #x10 :a #x80) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :r #x58 :g #x60 :b #x58 :a #x80) + (new 'static 'rgba :r #x58 :g #x60 :b #x58 :a #x80) + (new 'static 'rgba :r #x58 :g #x60 :b #x58 :a #x80) + (new 'static 'rgba :r #x58 :g #x60 :b #x58 :a #x80) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :r #x40 :g #x48 :b #x40 :a #x80) + (new 'static 'rgba :r #x40 :g #x48 :b #x40 :a #x80) + (new 'static 'rgba :r #x40 :g #x48 :b #x40 :a #x80) + (new 'static 'rgba :r #x40 :g #x48 :b #x40 :a #x80) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :r #x30 :g #x20 :b #x30 :a #x80) + (new 'static 'rgba :r #x30 :g #x20 :b #x30 :a #x80) + (new 'static 'rgba :r #x30 :g #x20 :b #x30 :a #x80) + (new 'static 'rgba :r #x30 :g #x20 :b #x30 :a #x80) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :r #x80 :g #x79 :b #x48 :a #x80) + (new 'static 'rgba :r #x80 :g #x79 :b #x48 :a #x80) + (new 'static 'rgba :r #x80 :g #x79 :b #x48 :a #x80) + (new 'static 'rgba :r #x80 :g #x79 :b #x48 :a #x80) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :r #x20 :g #x5e :b #x78 :a #x80) + (new 'static 'rgba :r #x20 :g #x5e :b #x78 :a #x80) + (new 'static 'rgba :r #x20 :g #x5e :b #x78 :a #x80) + (new 'static 'rgba :r #x20 :g #x5e :b #x78 :a #x80) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :r #x1d :g #x1d :b #x1d :a #x80) + (new 'static 'rgba :r #x1d :g #x1d :b #x1d :a #x80) + (new 'static 'rgba :r #x1d :g #x1d :b #x1d :a #x80) + (new 'static 'rgba :r #x1d :g #x1d :b #x1d :a #x80) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :r #x40 :g #x40 :b #x40 :a #x80) + (new 'static 'rgba :r #x40 :g #x40 :b #x40 :a #x80) + (new 'static 'rgba :r #x40 :g #x40 :b #x40 :a #x80) + (new 'static 'rgba :r #x40 :g #x40 :b #x40 :a #x80) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :r #x7a :g #x4d :b #x65 :a #x80) + (new 'static 'rgba :r #x7a :g #x4d :b #x65 :a #x80) + (new 'static 'rgba :r #x7a :g #x4d :b #x65 :a #x80) + (new 'static 'rgba :r #x7a :g #x4d :b #x65 :a #x80) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :r #x7a :g #x34 :b #x34 :a #x80) + (new 'static 'rgba :r #x7a :g #x34 :b #x34 :a #x80) + (new 'static 'rgba :r #x7a :g #x34 :b #x34 :a #x80) + (new 'static 'rgba :r #x7a :g #x34 :b #x34 :a #x80) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :r #x10 :g #x65 :b #x4c :a #x80) + (new 'static 'rgba :r #x10 :g #x65 :b #x4c :a #x80) + (new 'static 'rgba :r #x10 :g #x65 :b #x4c :a #x80) + (new 'static 'rgba :r #x10 :g #x65 :b #x4c :a #x80) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :r #x46 :g #x4a :b #x78 :a #x80) + (new 'static 'rgba :r #x46 :g #x4a :b #x78 :a #x80) + (new 'static 'rgba :r #x46 :g #x4a :b #x78 :a #x80) + (new 'static 'rgba :r #x46 :g #x4a :b #x78 :a #x80) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :r #x57 :g #x7e :b #x80 :a #x80) + (new 'static 'rgba :r #x57 :g #x7e :b #x80 :a #x80) + (new 'static 'rgba :r #x57 :g #x7e :b #x80 :a #x80) + (new 'static 'rgba :r #x57 :g #x7e :b #x80 :a #x80) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :r #x7f :g #x7b :b #x33 :a #x80) + (new 'static 'rgba :r #x7f :g #x7b :b #x33 :a #x80) + (new 'static 'rgba :r #x7f :g #x7b :b #x33 :a #x80) + (new 'static 'rgba :r #x7f :g #x7b :b #x33 :a #x80) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :r #x79 :g #x79 :b #x2 :a #x80) + (new 'static 'rgba :r #x79 :g #x79 :b #x2 :a #x80) + (new 'static 'rgba :r #x79 :g #x79 :b #x2 :a #x80) + (new 'static 'rgba :r #x79 :g #x79 :b #x2 :a #x80) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :r #x47 :g #x68 :b #x7a :a #x80) + (new 'static 'rgba :r #x47 :g #x68 :b #x7a :a #x80) + (new 'static 'rgba :r #x47 :g #x68 :b #x7a :a #x80) + (new 'static 'rgba :r #x47 :g #x68 :b #x7a :a #x80) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :r #xb7 :g #x80 :b #x7 :a #x80) + (new 'static 'rgba :r #xb7 :g #x80 :b #x7 :a #x80) + (new 'static 'rgba :r #xb7 :g #x80 :b #x7 :a #x80) + (new 'static 'rgba :r #xb7 :g #x80 :b #x7 :a #x80) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :r #x80 :g #x80 :b #x40 :a #x80) + (new 'static 'rgba :r #x80 :g #x80 :b #x40 :a #x80) + (new 'static 'rgba :r #x80 :g #x80 :b #x40 :a #x80) + (new 'static 'rgba :r #x80 :g #x80 :b #x40 :a #x80) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x80) + (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x80) + (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x80) + (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x80) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :r #x9a :g #x4d :a #x60) + (new 'static 'rgba :r #x9a :g #x4d :a #x60) + (new 'static 'rgba :r #x9a :g #x4d :a #x60) + (new 'static 'rgba :r #x9a :g #x4d :a #x60) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :r #x70 :g #x78 :b #x70 :a #x80) + (new 'static 'rgba :r #x70 :g #x78 :b #x70 :a #x80) + (new 'static 'rgba :r #x70 :g #x78 :b #x70 :a #x80) + (new 'static 'rgba :r #x70 :g #x78 :b #x70 :a #x80) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :r #x60 :a #x80) + (new 'static 'rgba :r #x60 :a #x80) + (new 'static 'rgba :r #x60 :a #x80) + (new 'static 'rgba :r #x60 :a #x80) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :r #x80 :g #x60 :b #x20 :a #x80) + (new 'static 'rgba :r #x80 :g #x60 :b #x20 :a #x80) + (new 'static 'rgba :r #x80 :g #x60 :b #x20 :a #x80) + (new 'static 'rgba :r #x80 :g #x60 :b #x20 :a #x80) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :b #x1 :a #x80) + (new 'static 'rgba :b #x1 :a #x80) + (new 'static 'rgba :b #x1 :a #x80) + (new 'static 'rgba :b #x1 :a #x80) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :r #x48 :g #x74 :b #x48 :a #x80) + (new 'static 'rgba :r #x48 :g #x74 :b #x48 :a #x80) + (new 'static 'rgba :r #x48 :g #x74 :b #x48 :a #x80) + (new 'static 'rgba :r #x48 :g #x74 :b #x48 :a #x80) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :g #x39 :b #x67 :a #x80) + (new 'static 'rgba :g #x39 :b #x67 :a #x80) + (new 'static 'rgba :g #x39 :b #x67 :a #x80) + (new 'static 'rgba :g #x39 :b #x67 :a #x80) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :r #x7c :a #x80) + (new 'static 'rgba :r #x7c :a #x80) + (new 'static 'rgba :r #x7c :a #x80) + (new 'static 'rgba :r #x7c :a #x80) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :r #x60 :g #x60 :b #x60 :a #x80) + (new 'static 'rgba :r #x60 :g #x60 :b #x60 :a #x80) + (new 'static 'rgba :r #x60 :g #x60 :b #x60 :a #x80) + (new 'static 'rgba :r #x60 :g #x60 :b #x60 :a #x80) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :r #x40 :g #x40 :b #x40 :a #x80) + (new 'static 'rgba :r #x40 :g #x40 :b #x40 :a #x80) + (new 'static 'rgba :r #x40 :g #x40 :b #x40 :a #x80) + (new 'static 'rgba :r #x40 :g #x40 :b #x40 :a #x80) + ) + ) + ) + ) + ) + +(defun font-set-tex0 ((arg0 (pointer gs-tex0)) (arg1 texture) (arg2 int) (arg3 int) (arg4 int)) + (set! (-> arg0 0) (new 'static 'gs-tex0 + :tcc #x1 + :cld #x1 + :cbp arg4 + :th (+ (log2 (+ (-> arg1 h) -1)) 1) + :tw (log2 (-> arg1 w)) + :tbw (-> arg1 width 0) + :tbp0 (/ arg2 64) + :psm arg3 + ) + ) + (none) + ) + +(defun set-font-color ((arg0 font-color) (arg1 int) (arg2 rgba) (arg3 rgba) (arg4 rgba)) + (set! (-> *font-work* color-table arg0 color 0) (the-as rgba arg1)) + (set! (-> *font-work* color-table arg0 color 1) arg2) + (set! (-> *font-work* color-table arg0 color 2) arg3) + (set! (-> *font-work* color-table arg0 color 3) arg4) + 0 + ) diff --git a/goal_src/jak3/engine/gfx/hw/display-h.gc b/goal_src/jak3/engine/gfx/hw/display-h.gc index 1951f2116d..c346eaca39 100644 --- a/goal_src/jak3/engine/gfx/hw/display-h.gc +++ b/goal_src/jak3/engine/gfx/hw/display-h.gc @@ -96,7 +96,7 @@ At any point in time, there are 3 frames in progress: (vu1-enable-user-menu vu1-renderer-mask) (force-sync uint32) (mem-reserve-size uint32) - (dma-buffer-overflow basic) + (dma-buffer-overflow symbol) ) (:methods (new (symbol type int int int int int) _type_) diff --git a/goal_src/jak3/engine/gfx/hw/display.gc b/goal_src/jak3/engine/gfx/hw/display.gc index 50cce2a6f4..3c7346eaa8 100644 --- a/goal_src/jak3/engine/gfx/hw/display.gc +++ b/goal_src/jak3/engine/gfx/hw/display.gc @@ -5,5 +5,632 @@ ;; name in dgo: display ;; dgos: GAME +(defconstant DMA_BUFFER_GLOBAL_SIZE (* 1280 1024)) ;; 1280K +;; (defconstant DMA_BUFFER_GLOBAL_SIZE (* 1280 1024 PROCESS_HEAP_MULT)) ;; expand based on actor heap expansion +(defconstant DMA_BUFFER_DEBUG_SIZE (* 8 1024 1024)) ;; 8M +;; (defconstant DMA_BUFFER_DEBUG_SIZE (* 12 1024 1024)) ;; expand to 12M because we can + +(defconstant DISPLAY_FPS_RATIO (/ (-> *display* time-factor) 5.0)) + ;; DECOMP BEGINS +(defun get-current-time () + "Get the base-clock time." + (-> *display* base-clock frame-counter) + ) + +(defun get-integral-current-time () + "Get the number of frames that have happened." + (-> *display* base-clock integral-frame-counter) + ) + +(defun get-real-current-time () + (-> *display* real-clock frame-counter) + ) + +(defmethod set-time-ratios ((this display) (arg0 float)) + (set! (-> this dog-ratio) (fmin 4.0 arg0)) + (case (get-video-mode) + (('pal) + (set! (-> this time-factor) 6.0) + ) + (else + (set! (-> this time-factor) 5.0) + ) + ) + (-> this dog-ratio) + ) + +(defun set-display ((arg0 display)) + "Allocate and initialize clocks for the display." + (dotimes (s5-0 22) + (set! (-> arg0 clock s5-0) (new 'global 'clock s5-0)) + ) + (set! (-> arg0 base-clock mask) (process-mask freeze pause menu progress)) + (set! (-> arg0 game-clock mask) (process-mask freeze pause menu progress movie)) + (set! (-> arg0 total-game-clock mask) (process-mask freeze pause menu progress)) + (set! (-> arg0 frame-clock mask) (process-mask freeze pause menu progress)) + (set! (-> arg0 target-clock mask) (process-mask freeze pause menu progress)) + (set! (-> arg0 camera-clock mask) (process-mask freeze pause menu progress)) + (set! (-> arg0 entity-clock mask) (process-mask freeze pause menu progress)) + (set! (-> arg0 part-clock mask) (process-mask freeze pause menu progress)) + (set! (-> arg0 bg-clock mask) (process-mask freeze pause menu progress)) + (set! (-> arg0 user0-clock mask) (process-mask freeze pause menu progress)) + (set! (-> arg0 user1-clock mask) (process-mask freeze pause menu progress)) + (set! (-> arg0 user2-clock mask) (process-mask freeze pause menu progress)) + (set! (-> arg0 user3-clock mask) (process-mask freeze pause menu progress)) + (set! (-> arg0 user4-clock mask) (process-mask freeze pause menu progress)) + (set! (-> arg0 user5-clock mask) (process-mask freeze pause menu progress)) + (set! (-> arg0 user6-clock mask) (process-mask freeze pause menu progress)) + (set! (-> arg0 user7-clock mask) (process-mask freeze pause menu progress)) + (set! (-> arg0 user8-clock mask) (process-mask freeze pause menu progress)) + (set! (-> arg0 user9-clock mask) (process-mask freeze pause menu progress)) + (set! (-> *listener-process* clock) (-> arg0 real-clock)) + (set! (-> *active-pool* clock) (-> arg0 real-clock)) + (set! (-> *display-pool* clock) (-> arg0 real-clock)) + (set! (-> *mid-pool* clock) (-> arg0 real-clock)) + (+! (-> arg0 real-clock ref-count) 4) + (set! (-> *camera-pool* clock) (-> arg0 camera-clock)) + (+! (-> arg0 camera-clock ref-count) 1) + (set! (-> *target-pool* clock) (-> arg0 target-clock)) + (+! (-> arg0 target-clock ref-count) 1) + (set! (-> *pusher-pool* clock) (-> arg0 entity-clock)) + (set! (-> *entity-pool* clock) (-> arg0 entity-clock)) + (+! (-> arg0 entity-clock ref-count) 2) + (set! (-> *bg-pool* clock) (-> arg0 bg-clock)) + (+! (-> arg0 bg-clock ref-count) 1) + (set! (-> *default-pool* clock) (-> arg0 base-clock)) + (+! (-> arg0 base-clock ref-count) 1) + (+! (-> *kernel-clock* ref-count) -10) + arg0 + ) + +(defun allocate-dma-buffers ((arg0 display)) + "Allocate the main, debug, and calc dma buffers." + (when (zero? (-> arg0 frames 0 calc-buf)) + (set! (-> arg0 frames 0 calc-buf) (new 'global 'dma-buffer 10000)) + (set! (-> arg0 frames 1 calc-buf) (new 'global 'dma-buffer 10000)) + (set! (-> arg0 frames 0 global-buf) (new 'global 'dma-buffer DMA_BUFFER_GLOBAL_SIZE)) + (set! (-> arg0 frames 1 global-buf) (new 'global 'dma-buffer DMA_BUFFER_GLOBAL_SIZE)) + (when *debug-segment* + (set! (-> arg0 frames 0 debug-buf) (new 'debug 'dma-buffer DMA_BUFFER_DEBUG_SIZE)) + (set! (-> arg0 frames 1 debug-buf) (new 'debug 'dma-buffer DMA_BUFFER_DEBUG_SIZE)) + ) + (set! (-> arg0 dma-buffer-overflow) #f) + (set! (-> arg0 mem-reserve-size) (the-as uint 0)) + 0 + ) + arg0 + ) + +(define *font-context* + (new 'global 'font-context *font-default-matrix* 0 0 0.0 (font-color default) (font-flags shadow kerning)) + ) + +;; WARN: Return type mismatch pointer vs none. +(defun draw-sprite2d-xy ((arg0 dma-buffer) (arg1 int) (arg2 int) (arg3 int) (arg4 int) (arg5 rgba) (arg6 int)) + "Draw a sprite primitive with the given color and dimensions." + (let* ((t2-2 (new 'stack 'draw-context arg1 arg2 arg3 arg4 arg5)) + (a0-3 (max 1792 (min 2304 (+ (-> t2-2 orgx) 1792)))) + (a3-3 (max 1840 (min 2256 (+ (-> t2-2 orgy) 1840)))) + (a1-6 (-> t2-2 width)) + (t1-2 (-> t2-2 height)) + (v1-6 (-> arg0 base)) + ) + (let* ((a2-2 arg0) + (t0-2 (the-as object (-> a2-2 base))) + ) + (set! (-> (the-as dma-packet t0-2) dma) (new 'static 'dma-tag :id (dma-tag-id cnt))) + (set! (-> (the-as dma-packet t0-2) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet t0-2) vif1) (new 'static 'vif-tag :cmd (vif-cmd direct) :msk #x1)) + (set! (-> a2-2 base) (&+ (the-as pointer t0-2) 16)) + ) + (let* ((a2-3 arg0) + (t0-4 (the-as object (-> a2-3 base))) + ) + (set! (-> (the-as gs-gif-tag t0-4) tag) + (new 'static 'gif-tag64 :nloop #x1 :eop #x1 :flg (gif-flag reg-list) :nreg #x4) + ) + (set! (-> (the-as gs-gif-tag t0-4) regs) + (new 'static 'gif-tag-regs :regs1 (gif-reg-id rgbaq) :regs2 (gif-reg-id xyzf2) :regs3 (gif-reg-id xyzf2)) + ) + (set! (-> a2-3 base) (&+ (the-as pointer t0-4) 16)) + ) + (let* ((a2-4 arg0) + (t0-6 (-> a2-4 base)) + ) + (set! (-> (the-as (pointer gs-prim) t0-6) 0) (new 'static 'gs-prim :prim (gs-prim-type sprite) :abe #x1)) + (set! (-> (the-as (pointer gs-rgbaq) t0-6) 1) (the-as gs-rgbaq (-> t2-2 color 0))) + (set! (-> (the-as (pointer gs-xyzf) t0-6) 2) (new 'static 'gs-xyzf :x (* a0-3 16) :y (* a3-3 16) :z arg6)) + (set! (-> (the-as (pointer gs-xyzf) t0-6) 3) (new 'static 'gs-xyzf + :x (* (max 1792 (min 2304 (+ a0-3 a1-6))) 16) + :y (* (max 1840 (min 2256 (+ a3-3 t1-2))) 16) + :z arg6 + ) + ) + (set! (-> a2-4 base) (&+ t0-6 32)) + ) + (let ((a0-12 (/ (the-as int (+ (- -16 (the-as int v1-6)) (the-as int (-> arg0 base)))) 16))) + (cond + ((nonzero? a0-12) + (logior! (-> (the-as (pointer uint64) v1-6) 0) (shr (shl a0-12 48) 48)) + (logior! (-> (the-as (pointer uint64) v1-6) 1) (shl (shr (shl a0-12 48) 48) 32)) + ) + (else + (set! (-> arg0 base) v1-6) + ) + ) + ) + ) + (none) + ) + +;; WARN: Return type mismatch pointer vs none. +(defun draw-sprite2d-xy-absolute ((arg0 dma-buffer) (arg1 int) (arg2 int) (arg3 int) (arg4 int) (arg5 rgba) (arg6 int)) + "Draw a sprite primitive, setting the gs-xzyf register to exactly the values specified (no offset/clamp)." + (let ((a1-1 (+ arg1 1792)) + (a2-1 (+ arg2 1840)) + (v1-0 (-> arg0 base)) + ) + (let* ((t3-0 arg0) + (t4-0 (the-as object (-> t3-0 base))) + ) + (set! (-> (the-as dma-packet t4-0) dma) (new 'static 'dma-tag :id (dma-tag-id cnt))) + (set! (-> (the-as dma-packet t4-0) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet t4-0) vif1) (new 'static 'vif-tag :cmd (vif-cmd direct) :msk #x1)) + (set! (-> t3-0 base) (&+ (the-as pointer t4-0) 16)) + ) + (let* ((t3-1 arg0) + (t4-2 (the-as object (-> t3-1 base))) + ) + (set! (-> (the-as gs-gif-tag t4-2) tag) + (new 'static 'gif-tag64 :nloop #x1 :eop #x1 :flg (gif-flag reg-list) :nreg #x4) + ) + (set! (-> (the-as gs-gif-tag t4-2) regs) + (new 'static 'gif-tag-regs :regs1 (gif-reg-id rgbaq) :regs2 (gif-reg-id xyzf2) :regs3 (gif-reg-id xyzf2)) + ) + (set! (-> t3-1 base) (&+ (the-as pointer t4-2) 16)) + ) + (let* ((t3-2 arg0) + (t4-4 (-> t3-2 base)) + ) + (set! (-> (the-as (pointer gs-prim) t4-4) 0) (new 'static 'gs-prim :prim (gs-prim-type sprite) :abe #x1)) + (set! (-> (the-as (pointer gs-rgbaq) t4-4) 1) (the-as gs-rgbaq arg5)) + (set! (-> (the-as (pointer gs-xyzf) t4-4) 2) (new 'static 'gs-xyzf :x (* a1-1 16) :y (* a2-1 16) :z arg6)) + (set! (-> (the-as (pointer gs-xyzf) t4-4) 3) + (new 'static 'gs-xyzf :x (* (+ a1-1 arg3) 16) :y (* (+ a2-1 arg4) 16) :z arg6) + ) + (set! (-> t3-2 base) (&+ t4-4 32)) + ) + (let ((a1-10 (/ (the-as int (+ (- -16 (the-as int v1-0)) (the-as int (-> arg0 base)))) 16))) + (cond + ((nonzero? a1-10) + (set! (-> (the-as (pointer uint64) v1-0) 0) + (logior (-> (the-as (pointer uint64) v1-0)) (shr (shl a1-10 48) 48)) + ) + (logior! (-> (the-as (pointer uint64) v1-0) 1) (shl (shr (shl a1-10 48) 48) 32)) + ) + (else + (set! (-> arg0 base) v1-0) + ) + ) + ) + ) + (none) + ) + +;; WARN: Return type mismatch pointer vs none. +(defun draw-quad2d ((arg0 dma-buffer) (arg1 draw-context)) + "Draw a quad that fills the entire context." + (let ((a3-1 (max 1792 (min 2304 (+ (-> arg1 orgx) 1792)))) + (a2-3 (max 1840 (min 2256 (+ (-> arg1 orgy) 1840)))) + (t3-0 (-> arg1 width)) + (t0-2 (-> arg1 height)) + (v1-4 (-> arg0 base)) + ) + (let* ((t1-0 arg0) + (t2-0 (the-as object (-> t1-0 base))) + ) + (set! (-> (the-as dma-packet t2-0) dma) (new 'static 'dma-tag :id (dma-tag-id cnt))) + (set! (-> (the-as dma-packet t2-0) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet t2-0) vif1) (new 'static 'vif-tag :cmd (vif-cmd direct) :msk #x1)) + (set! (-> t1-0 base) (&+ (the-as pointer t2-0) 16)) + ) + (let* ((t1-1 arg0) + (t2-2 (the-as object (-> t1-1 base))) + ) + (set! (-> (the-as gs-gif-tag t2-2) tag) + (new 'static 'gif-tag64 :nloop #x1 :eop #x1 :flg (gif-flag reg-list) :nreg #x9) + ) + (set! (-> (the-as gs-gif-tag t2-2) regs) (new 'static 'gif-tag-regs + :regs1 (gif-reg-id rgbaq) + :regs2 (gif-reg-id xyzf2) + :regs3 (gif-reg-id rgbaq) + :regs4 (gif-reg-id xyzf2) + :regs5 (gif-reg-id rgbaq) + :regs6 (gif-reg-id xyzf2) + :regs7 (gif-reg-id rgbaq) + :regs8 (gif-reg-id xyzf2) + ) + ) + (set! (-> t1-1 base) (&+ (the-as pointer t2-2) 16)) + ) + (let* ((t1-2 arg0) + (t2-4 (-> t1-2 base)) + ) + (set! (-> (the-as (pointer gs-prim) t2-4) 0) + (new 'static 'gs-prim :prim (gs-prim-type tri-strip) :iip #x1 :abe #x1) + ) + (set! (-> (the-as (pointer gs-rgbaq) t2-4) 1) (the-as gs-rgbaq (-> arg1 color 0))) + (set! (-> (the-as (pointer gs-xyzf) t2-4) 2) (new 'static 'gs-xyzf :y (* a2-3 16) :x (* a3-1 16))) + (set! (-> (the-as (pointer gs-rgbaq) t2-4) 3) (the-as gs-rgbaq (-> arg1 color 1))) + (set! (-> (the-as (pointer gs-xyzf) t2-4) 4) + (new 'static 'gs-xyzf :y (* a2-3 16) :x (* (max 1792 (min 2304 (+ a3-1 t3-0))) 16)) + ) + (set! (-> (the-as (pointer gs-rgbaq) t2-4) 5) (the-as gs-rgbaq (-> arg1 color 2))) + (set! (-> (the-as (pointer gs-xyzf) t2-4) 6) + (new 'static 'gs-xyzf :y (* (max 1840 (min 2256 (+ a2-3 t0-2))) 16) :x (* a3-1 16)) + ) + (set! (-> (the-as (pointer gs-rgbaq) t2-4) 7) (the-as gs-rgbaq (-> arg1 color 3))) + (set! (-> (the-as (pointer gs-xyzf) t2-4) 8) (new 'static 'gs-xyzf + :y (* (max 1840 (min 2256 (+ a2-3 t0-2))) 16) + :x (* (max 1792 (min 2304 (+ a3-1 t3-0))) 16) + ) + ) + (set! (-> (the-as (pointer uint64) t2-4) 9) (the-as uint 0)) + (set! (-> t1-2 base) (&+ t2-4 80)) + ) + (let ((a1-11 (/ (the-as int (+ (- -16 (the-as int v1-4)) (the-as int (-> arg0 base)))) 16))) + (cond + ((nonzero? a1-11) + (set! (-> (the-as (pointer uint64) v1-4) 0) + (logior (-> (the-as (pointer uint64) v1-4)) (shr (shl a1-11 48) 48)) + ) + (logior! (-> (the-as (pointer uint64) v1-4) 1) (shl (shr (shl a1-11 48) 48) 32)) + ) + (else + (set! (-> arg0 base) v1-4) + ) + ) + ) + ) + (none) + ) + +(defun screen-gradient ((arg0 dma-buffer) (arg1 rgba) (arg2 rgba) (arg3 rgba) (arg4 rgba)) + "Fill the screen with a sprite with the given colors." + (let ((a1-2 (new 'stack 'draw-context 0 0 512 416 (new 'static 'rgba)))) + (set! (-> a1-2 color 0) arg1) + (set! (-> a1-2 color 1) arg2) + (set! (-> a1-2 color 2) arg3) + (set! (-> a1-2 color 3) arg4) + (draw-quad2d arg0 a1-2) + ) + (none) + ) + +(defun vif1-handler-debug ((mark-in int)) + "Handle the VIF1 interrupt. + The mark register of VIF will be set to the bucket that is now starting." + + ; B0: + ; L42: + ; daddiu sp, sp, -32 + ; sd ra, 0(sp) + ; sd s7, 16(sp) + ; bgezal r0, L43 + ; sll r0, r0, 0 + + ; B1: + ; L43: + ; daddiu fp, ra, -20 + ; lw s7, L41(fp) + ; lw s7, 0(s7) + ; daddiu s7, s7, -8 + ; lw v1, *profile-interrupt-segment*(s7) + (let* ((prof *profile-interrupt-segment*) ;; v1 + ; lui a0, 4096 + ; ori a0, a0, 15360 + ; lwu a0, 48(a0) + (mark mark-in) ;; (-> VIF1_BANK mark) (TODO actually set mark somehow) + ; lw a1, *profile-work*(s7) + ; lw a2, 64(a1) + (last-index (-> *profile-work* last-index)) + + ; lh a3, 4(v1) + (base-time (-> prof base-time)) + ; lui a1, 4096 + ; ori a1, a1, 2048 + ; lwu a1, 0(a1) + ; sync.l + (current-time (timer-count TIMER1_BANK)) + (delta-time (the uint 0)) + ) + + + (cond + ; sltu t0, a0, a2 t0 = (mark < last-index) + ; beq t0, r0, L46 + ; sll r0, r0, 0 + ((< mark last-index) + ;; the mark jumped backward, we must be starting a new frame + ;; clear all profile info. + + + ; B2: + ; addiu a2, r0, 0 + ; beq r0, r0, L45 + ; sll r0, r0, 0 + (dotimes (i (enum-length bucket-id)) + ; B3: + ; L44: + ; dsll a3, a2, 4 + ; daddu a3, v1, a3 + ; sh r0, 48(a3) + (set! (-> prof data i start-time) 0) + ; dsll a3, a2, 4 + ; daddu a3, v1, a3 + ; sh r0, 50(a3) + (set! (-> prof data i end-time) 0) + ; dsll a3, a2, 4 + ; daddu a3, v1, a3 + ; sb r0, 53(a3) + (set! (-> prof data i count) 0) + ; daddiu a2, a2, 1 + ; B4: + ; L45: + ; slti a3, a2, 327 + ; bne a3, r0, L44 + ; sll r0, r0, 0 + ) + + ; B5: + ; or a2, s7, r0 + ; or a2, s7, r0 + ; sh a1, 4(v1) + (set! (-> prof base-time) (the int current-time)) + ; addiu a1, r0, 0 + ; sh r0, 48(v1) + (set! (-> prof data 0 start-time) 0) ;; why do it again... + ; addiu a2, r0, 327 + ; sh a2, 0(v1) + (set! (-> prof count) (enum-length bucket-id)) + ; beq r0, r0, L47 + ; sll r0, r0, 0 + ) ;; end (>= mark last-index) + (else + + ; B6: + ; L46: + ; dsubu a1, a1, a3 + ;(let ((delta-time (- current-time base-time))) + (set! delta-time (- current-time base-time)) + + ; dsll a2, a2, 4 + ; daddu a2, v1, a2 + ; sh a1, 50(a2) + (set! (-> prof data last-index end-time) (the int delta-time)) + ; (format 0 "mark: ~D last ~D elapsed ~D~%" mark last-index + ; (- (-> prof data last-index end-time) + ; (-> prof data last-index start-time))) + + ; sh a1, 50(v1) + (set! (-> prof data 0 end-time) (the int delta-time)) + ; or a2, a1, r0 + ;) + ) ;; end else + ) ;; end cond + ; B7: + ; L47: + ; dsll a2, a0, 4 + ; daddu a2, v1, a2 + ; sb a0, 53(a2) + (set! (-> prof data mark count) mark) + ; dsll a2, a0, 4 + ; daddu v1, v1, a2 + ; sh a1, 48(v1) + (set! (-> prof data mark start-time) (the int delta-time)) + ; lw v1, *profile-work*(s7) + ; sw a0, 64(v1) + (set! (-> *profile-work* last-index) mark) + ; lui v1, 4096 + ; ori v1, v1, 15360 + ; sw r0, 48(v1) + ;; CLEAR mark + ; addiu v1, r0, 8 + ; lui a0, 4096 + ; ori a0, a0, 15360 + ; sw v1, 16(a0) + ;; write STC to VIF FBRST (reset various things) + ; addiu v0, r0, 0 + ; ld ra, 0(sp) + ; ld s7, 16(sp) + ; sync.l + ; ei + ; jr ra + ; daddiu sp, sp, 32 + ) + + (none) + ;; .endfunction + ) + +(defun vif1-handler () + ; B0: + ; L8: + ; daddiu sp, sp, -32 + ; sd ra, 0(sp) + ; sd s7, 16(sp) + ; bgezal r0, L9 + ; sll r0, r0, 0 + + ; B1: + ; L9: + ; daddiu fp, ra, -20 + ; lw s7, L7(fp) + ; lw s7, 0(s7) + ; daddiu s7, s7, -8 + + ; lui v1, 4096 + ; ori v1, v1, 15360 + ; sw r0, 48(v1) + ;; clear mark + + ; addiu v1, r0, 8 + ; lui a0, 4096 + ; ori a0, a0, 15360 + ; sw v1, 16(a0) + ;; write STC to VIF FBRST (reset various things) + + ; addiu v0, r0, 0 + ; ld ra, 0(sp) + ; ld s7, 16(sp) + ; sync.l + ; ei + ; jr ra + ; daddiu sp, sp, 32 + + ; sll r0, r0, 0 + ; sll r0, r0, 0 + ) + +(install-handler 5 (if *debug-segment* + vif1-handler-debug + vif1-handler + ) + ) + +(defun vblank-handler () + "Record the time of the last two vblanks." + ; L5: + ; daddiu sp, sp, -32 + ; sd ra, 0(sp) + ; sd s7, 16(sp) + ; bgezal r0, L6 + ; sll r0, r0, 0 + + ; B1: + ; L6: + ; daddiu fp, ra, -20 + ; lw s7, L4(fp) + ; lw s7, 0(s7) + ; daddiu s7, s7, -8 + ; lw v1, *display*(s7) + ; ld v1, 108(v1) + ; lw a0, *display*(s7) + ; sd v1, 100(a0) + (set! (-> *display* vblank-start-time 0) (-> *display* vblank-start-time 1)) + ; lw t9, timer-count(s7) + ; lui v1, 4096 + ; ori a0, v1, 2048 + ; jalr ra, t9 + ; sll v0, ra, 0 + + ; lw v1, *display*(s7) + ; sd v0, 108(v1) + (set! (-> *display* vblank-start-time 1) (the-as int (timer-count TIMER1_BANK))) ;; not really a time-frame. + ; addiu v0, r0, 0 + 0 + ; ld ra, 0(sp) + ; ld s7, 16(sp) + ; sync.l + ; ei + ; jr ra + ; daddiu sp, sp, 32 + + ; sll r0, r0, 0 + ; sll r0, r0, 0 + ) + +(defun set-display-gs-state ((arg0 dma-buffer) (arg1 int) (arg2 int) (arg3 int) (arg4 int) (arg5 int)) + (let ((v1-1 (/ (+ arg2 63) 64)) + (t2-0 *display*) + (t3-0 144) + ) + (+! (-> t2-0 mem-reserve-size) t3-0) + (when (not (-> t2-0 dma-buffer-overflow)) + (let ((t5-0 (-> t2-0 frames (-> t2-0 on-screen) global-buf))) + (if (< (-> t5-0 real-buffer-end) (the-as int (&+ (-> t5-0 base) t3-0))) + (set! (-> t2-0 dma-buffer-overflow) #t) + ) + ) + (if (not (-> t2-0 dma-buffer-overflow)) + (dma-buffer-add-gs-set-flusha arg0 + (scissor-1 (new 'static 'gs-scissor :scax1 (+ arg2 -1) :scay1 (+ arg3 -1))) + (xyoffset-1 (new 'static 'gs-xy-offset)) + (frame-1 (new 'static 'gs-frame :fbp arg1 :fbw v1-1 :psm arg5 :fbmsk arg4)) + (test-1 (new 'static 'gs-test :zte #x1 :ztst (gs-ztest always))) + (texa (new 'static 'gs-texa :ta0 #x80 :ta1 #x80)) + (zbuf-1 (new 'static 'gs-zbuf :zbp #x130 :psm (gs-psm ct24) :zmsk #x1)) + (texflush 0) + ) + ) + ) + ) + arg0 + ) + +(defun set-display-gs-state-offset ((arg0 dma-buffer) (arg1 int) (arg2 int) (arg3 int) (arg4 int) (arg5 int) (arg6 int) (arg7 int)) + (let ((v1-1 (/ (+ arg2 63) 64)) + (t4-0 *display*) + (t5-0 144) + ) + (+! (-> t4-0 mem-reserve-size) t5-0) + (when (not (-> t4-0 dma-buffer-overflow)) + (let ((t7-0 (-> t4-0 frames (-> t4-0 on-screen) global-buf))) + (if (< (-> t7-0 real-buffer-end) (the-as int (&+ (-> t7-0 base) t5-0))) + (set! (-> t4-0 dma-buffer-overflow) #t) + ) + ) + (if (not (-> t4-0 dma-buffer-overflow)) + (dma-buffer-add-gs-set-flusha arg0 + (scissor-1 (new 'static 'gs-scissor :scax1 (+ arg2 -1) :scay1 (+ arg3 -1))) + (xyoffset-1 (new 'static 'gs-xy-offset :ofx (* arg6 16) :ofy (* arg7 16))) + (frame-1 (new 'static 'gs-frame :fbp arg1 :fbw v1-1 :psm arg5 :fbmsk arg4)) + (test-1 (new 'static 'gs-test :zte #x1 :ztst (gs-ztest always))) + (texa (new 'static 'gs-texa :ta0 #x80 :ta1 #x80)) + (zbuf-1 (new 'static 'gs-zbuf :zbp #x130 :psm (gs-psm ct24) :zmsk #x1)) + (texflush 0) + ) + ) + ) + ) + arg0 + ) + +(defun reset-display-gs-state ((arg0 display) (arg1 dma-buffer)) + (let ((v1-0 *display*) + (a2-0 144) + ) + (+! (-> v1-0 mem-reserve-size) a2-0) + (when (not (-> v1-0 dma-buffer-overflow)) + (let ((t0-0 (-> v1-0 frames (-> v1-0 on-screen) global-buf))) + (if (< (-> t0-0 real-buffer-end) (the-as int (&+ (-> t0-0 base) a2-0))) + (set! (-> v1-0 dma-buffer-overflow) #t) + ) + ) + (if (not (-> v1-0 dma-buffer-overflow)) + (dma-buffer-add-gs-set-flusha arg1 + (scissor-1 (new 'static 'gs-scissor :scax1 #x1ff :scay1 #x19f)) + (xyoffset-1 (new 'static 'gs-xy-offset :ofx #x7000 :ofy #x7300)) + (frame-1 (new 'static 'gs-frame :fbp #x198 :fbw #x8)) + (test-1 (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal))) + (texa (new 'static 'gs-texa :ta1 #x80)) + (zbuf-1 (new 'static 'gs-zbuf :zbp #x130 :psm (gs-psm ct24))) + (texflush 0) + ) + ) + ) + ) + arg0 + ) + +(kmemopen global "dma-buffers") + +(define *vu0-dma-list* (new 'global 'dma-buffer 4096)) + +(define *display* (new 'global 'display 0 512 416 2 49)) + +(allocate-dma-buffers *display*) + +(kmemclose) diff --git a/goal_src/jak3/engine/gfx/hw/video-h.gc b/goal_src/jak3/engine/gfx/hw/video-h.gc index 7b6b8b43cf..4f17968a6a 100644 --- a/goal_src/jak3/engine/gfx/hw/video-h.gc +++ b/goal_src/jak3/engine/gfx/hw/video-h.gc @@ -5,6 +5,8 @@ ;; name in dgo: video-h ;; dgos: GAME +(define-extern get-video-mode (function symbol)) + ;; DECOMP BEGINS (deftype video-params (structure) diff --git a/goal_src/jak3/engine/gfx/vu1-user-h.gc b/goal_src/jak3/engine/gfx/vu1-user-h.gc index 911715df99..6af083d08c 100644 --- a/goal_src/jak3/engine/gfx/vu1-user-h.gc +++ b/goal_src/jak3/engine/gfx/vu1-user-h.gc @@ -610,6 +610,8 @@ (bucket582 582) (bucket583 583) (debug-no-zbuf2 584) + (bucket585 585) + (bucket586 586) ) ;; ---bucket-id diff --git a/goal_src/jak3/engine/ui/text-h.gc b/goal_src/jak3/engine/ui/text-h.gc index 10a3898b59..2f7b459f8c 100644 --- a/goal_src/jak3/engine/ui/text-h.gc +++ b/goal_src/jak3/engine/ui/text-h.gc @@ -916,3 +916,27 @@ ;; DECOMP BEGINS +(deftype game-text (structure) + ((id text-id) + (text string) + ) + ) + + +(deftype game-text-info (basic) + ((length int32) + (language-id int32) + (group-name string) + (data game-text :dynamic) + ) + (:methods + (lookup-text! (_type_ text-id symbol) string) + ) + ) + + +(define *text-group-names* (new 'static 'boxed-array :type string "common")) + +(define *common-text-heap* (new 'global 'kheap)) + +(define *common-text* (the-as game-text-info #f)) diff --git a/goal_src/jak3/engine/util/profile-h.gc b/goal_src/jak3/engine/util/profile-h.gc index 21e3c9939b..6df52a4cf3 100644 --- a/goal_src/jak3/engine/util/profile-h.gc +++ b/goal_src/jak3/engine/util/profile-h.gc @@ -70,7 +70,7 @@ (deftype profile-spec (structure) "Specification for a profile category." - ((name basic) + ((name symbol) (color rgba) ) ) diff --git a/goal_src/jak3/engine/util/profile.gc b/goal_src/jak3/engine/util/profile.gc index 32b4524fe0..14b6f735fe 100644 --- a/goal_src/jak3/engine/util/profile.gc +++ b/goal_src/jak3/engine/util/profile.gc @@ -5,5 +5,997 @@ ;; name in dgo: profile ;; dgos: GAME +(define-extern *dproc* process) + ;; DECOMP BEGINS +(define *profile-spec-array* + (new 'static 'inline-array profile-spec 14 + (new 'static 'profile-spec :name 'dummy :color (new 'static 'rgba :r #x20 :g #x20 :b #x20 :a #x80)) + (new 'static 'profile-spec :name 'blit-displays :color (new 'static 'rgba :r #x20 :g #x20 :b #x80 :a #x80)) + (new 'static 'profile-spec :name 'sky :color (new 'static 'rgba :r #x20 :g #x80 :b #x20 :a #x80)) + (new 'static 'profile-spec :name 'ocean :color (new 'static 'rgba :r #x20 :g #x80 :b #x80 :a #x80)) + (new 'static 'profile-spec :name 'hfrag :color (new 'static 'rgba :r #x80 :g #x20 :b #x20 :a #x80)) + (new 'static 'profile-spec :name 'tfrag :color (new 'static 'rgba :r #x80 :g #x20 :b #x80 :a #x80)) + (new 'static 'profile-spec :name 'texture :color (new 'static 'rgba :r #x80 :g #x80 :b #x20 :a #x80)) + (new 'static 'profile-spec :name 'tie :color (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x80)) + (new 'static 'profile-spec :name 'generic :color (new 'static 'rgba :r #xc0 :g #xc0 :a #x80)) + (new 'static 'profile-spec :name 'merc :color (new 'static 'rgba :r #xc0 :b #xc0 :a #x80)) + (new 'static 'profile-spec :name 'shrubbery :color (new 'static 'rgba :r #xc0 :a #x80)) + (new 'static 'profile-spec :name 'particle :color (new 'static 'rgba :g #xc0 :b #xc0 :a #x80)) + (new 'static 'profile-spec :name 'debug :color (new 'static 'rgba :g #xc0 :a #x80)) + (new 'static 'profile-spec :name 'other :color (new 'static 'rgba :r #xc0 :g #xc0 :b #xc0 :a #x80)) + ) + ) + +(define *profile-translate-array* (new 'static 'array uint64 584 + #x0 + #x0 + #x0 + #x1 + #x6 + #x2 + #x3 + #x6 + #x4 + #x4 + #x6 + #x5 + #x7 + #x7 + #x5 + #x7 + #x7 + #x9 + #x9 + #x8 + #x7 + #x8 + #x6 + #x5 + #x7 + #x7 + #x5 + #x7 + #x7 + #x9 + #x9 + #x8 + #x7 + #x8 + #x6 + #x5 + #x7 + #x7 + #x5 + #x7 + #x7 + #x9 + #x9 + #x8 + #x7 + #x8 + #x6 + #x5 + #x7 + #x7 + #x5 + #x7 + #x7 + #x9 + #x9 + #x8 + #x7 + #x8 + #x6 + #x5 + #x7 + #x7 + #x5 + #x7 + #x7 + #x9 + #x9 + #x8 + #x7 + #x8 + #x6 + #x5 + #x7 + #x7 + #x5 + #x7 + #x7 + #x9 + #x9 + #x8 + #x7 + #x8 + #x6 + #x5 + #x7 + #x7 + #x5 + #x7 + #x7 + #x9 + #x9 + #x8 + #x7 + #x8 + #x6 + #x5 + #x7 + #x7 + #x5 + #x7 + #x7 + #x9 + #x9 + #x8 + #x7 + #x8 + #x6 + #x5 + #x7 + #x7 + #x5 + #x7 + #x7 + #x9 + #x9 + #x8 + #x7 + #x8 + #x6 + #x5 + #x7 + #x7 + #x5 + #x7 + #x7 + #x9 + #x9 + #x8 + #x7 + #x8 + #x6 + #xa + #x8 + #xa + #xa + #x8 + #x9 + #x9 + #x8 + #x8 + #x6 + #xa + #x8 + #xa + #xa + #x8 + #x9 + #x9 + #x8 + #x8 + #x6 + #xa + #x8 + #xa + #xa + #x8 + #x9 + #x9 + #x8 + #x8 + #x6 + #xa + #x8 + #xa + #xa + #x8 + #x9 + #x9 + #x8 + #x8 + #x6 + #xa + #x8 + #xa + #xa + #x8 + #x9 + #x9 + #x8 + #x8 + #x6 + #xa + #x8 + #xa + #xa + #x8 + #x9 + #x9 + #x8 + #x8 + #x6 + #xa + #x8 + #xa + #xa + #x8 + #x9 + #x9 + #x8 + #x8 + #x6 + #xa + #x8 + #xa + #xa + #x8 + #x9 + #x9 + #x8 + #x8 + #x6 + #xa + #x8 + #xa + #xa + #x8 + #x9 + #x9 + #x8 + #x8 + #x6 + #xa + #x8 + #xa + #xa + #x8 + #x9 + #x9 + #x8 + #x8 + #x6 + #x5 + #x7 + #x7 + #x9 + #x9 + #x8 + #x5 + #x7 + #x7 + #x8 + #x6 + #x5 + #x7 + #x7 + #x9 + #x9 + #x8 + #x5 + #x7 + #x7 + #x8 + #x6 + #x5 + #x7 + #x7 + #x9 + #x9 + #x8 + #x5 + #x7 + #x7 + #x8 + #x6 + #x5 + #x7 + #x7 + #x9 + #x9 + #x8 + #x5 + #x7 + #x7 + #x8 + #x6 + #x5 + #x7 + #x7 + #x9 + #x9 + #x8 + #x5 + #x7 + #x7 + #x8 + #x6 + #x5 + #x7 + #x7 + #x9 + #x9 + #x8 + #x5 + #x7 + #x7 + #x8 + #x6 + #x5 + #x7 + #x7 + #x9 + #x9 + #x8 + #x5 + #x7 + #x7 + #x8 + #x6 + #x5 + #x7 + #x7 + #x9 + #x9 + #x8 + #x5 + #x7 + #x7 + #x8 + #x6 + #x5 + #x7 + #x7 + #x9 + #x9 + #x8 + #x5 + #x7 + #x7 + #x8 + #x6 + #x5 + #x7 + #x7 + #x9 + #x9 + #x8 + #x5 + #x7 + #x7 + #x8 + #x6 + #x9 + #x9 + #x8 + #x8 + #x6 + #x9 + #x9 + #x8 + #x8 + #xd + #x6 + #x9 + #x9 + #x8 + #x8 + #x6 + #x9 + #x9 + #x8 + #x8 + #x6 + #x9 + #x9 + #x8 + #x8 + #x6 + #x9 + #x9 + #x8 + #x8 + #x6 + #x9 + #x9 + #x8 + #x8 + #x6 + #x9 + #x9 + #x8 + #x8 + #x6 + #x9 + #x9 + #x8 + #x8 + #x6 + #x9 + #x9 + #x8 + #x8 + #x6 + #x9 + #x9 + #x8 + #x8 + #x6 + #x9 + #x9 + #x8 + #x8 + #x6 + #x9 + #x9 + #x8 + #x8 + #x6 + #x9 + #x9 + #x8 + #x8 + #x6 + #x9 + #x9 + #x8 + #x8 + #x6 + #x9 + #x9 + #x8 + #x8 + #x6 + #x9 + #x9 + #x8 + #x8 + #x6 + #x9 + #x9 + #x8 + #x8 + #x6 + #x9 + #x9 + #x8 + #x8 + #x6 + #x9 + #x9 + #x8 + #x8 + #x6 + #x9 + #x9 + #x8 + #x8 + #x6 + #x9 + #x9 + #x8 + #x8 + #x6 + #x9 + #x9 + #x8 + #x8 + #x6 + #x9 + #x9 + #x8 + #x8 + #x6 + #x3 + #x6 + #x9 + #x8 + #x5 + #x7 + #x7 + #x7 + #x5 + #x7 + #x8 + #x6 + #x9 + #x8 + #x5 + #x7 + #x7 + #x7 + #x5 + #x7 + #x8 + #x6 + #x9 + #x8 + #x5 + #x7 + #x7 + #x7 + #x5 + #x7 + #x8 + #x6 + #x9 + #x8 + #x5 + #x7 + #x7 + #x7 + #x5 + #x7 + #x8 + #x6 + #x9 + #x8 + #x5 + #x7 + #x7 + #x7 + #x5 + #x7 + #x8 + #x6 + #x9 + #x8 + #x5 + #x7 + #x7 + #x7 + #x5 + #x7 + #x8 + #x6 + #x9 + #x8 + #x5 + #x7 + #x7 + #x7 + #x5 + #x7 + #x8 + #x6 + #x9 + #x8 + #x5 + #x7 + #x7 + #x7 + #x5 + #x7 + #x8 + #x6 + #x9 + #x8 + #x5 + #x7 + #x7 + #x7 + #x5 + #x7 + #x8 + #x6 + #x9 + #x8 + #x5 + #x7 + #x7 + #x7 + #x5 + #x7 + #x8 + #x6 + #x9 + #x8 + #x8 + #x1 + #x6 + #x8 + #xb + #xd + #xd + #x6 + #x9 + #xc + #x6 + #xd + #xd + #xd + #xd + #xc + #xc + #xc + ) + ) + +(deftype profile-work (structure) + "DMA templates for profile drawing." + ((sprite-tmpl dma-gif-packet :inline) + (line-tmpl dma-gif-packet :inline) + (last-index int32) + ) + ) + + +(define *profile-work* (new 'static 'profile-work + :sprite-tmpl (new 'static 'dma-gif-packet + :dma-vif (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x4 :id (dma-tag-id cnt)) + :vif1 (new 'static 'vif-tag :imm #x4 :cmd (vif-cmd direct) :msk #x1) + ) + :gif (new 'static 'array uint64 2 #x3023400000008001 #x551) + ) + :line-tmpl (new 'static 'dma-gif-packet + :dma-vif (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x4 :id (dma-tag-id cnt)) + :vif1 (new 'static 'vif-tag :imm #x4 :cmd (vif-cmd direct) :msk #x1) + ) + :gif (new 'static 'array uint64 2 #x3020c00000008001 #x551) + ) + ) + ) + +(define *profile-x* 1808) + +(define *profile-y* 1848) + +(define *profile-w* 416) + +(define *profile-h* 8) + +(define *profile-ticks* #f) + +(defmethod start-frame! ((this profile-segment-array)) + "Restart the profiler for the start of a frame." + (set! (-> this count) 0) + (set! (-> this depth) 0) + (set! (-> this max-depth) 0) + (set! (-> this base-time) (the-as int (timer-count (the-as timer-bank #x10000800)))) + (start-segment! this 'all *profile-all-color*) + 0 + (none) + ) + +(defmethod start-segment! ((this profile-segment-array) (arg0 symbol) (arg1 rgba)) + "Start an event." + (when (and *dproc* *debug-segment*) + (let ((s4-0 (-> this data (-> this count)))) + (let ((s3-0 (-> this base-time))) + (set! (-> s4-0 name) arg0) + (set! (-> s4-0 start-time) (the-as int (- (timer-count (the-as timer-bank #x10000800)) (the-as uint s3-0)))) + ) + (set! (-> s4-0 depth) (the-as uint (-> this depth))) + (set! (-> s4-0 color) arg1) + (set! (-> this segment (-> this depth)) s4-0) + ) + (set! (-> this count) (min 1023 (+ (-> this count) 1))) + (+! (-> this depth) 1) + (set! (-> this max-depth) (max (-> this max-depth) (-> this depth))) + ) + 0 + (none) + ) + +(defmethod end-segment! ((this profile-segment-array)) + "Stop the most recently started event." + (when (and *dproc* *debug-segment*) + (let* ((v1-4 (+ (-> this depth) -1)) + (s5-0 (-> this segment v1-4)) + (s4-0 (-> this base-time)) + ) + (when (>= v1-4 0) + (set! (-> s5-0 end-time) (the-as int (- (timer-count (the-as timer-bank #x10000800)) (the-as uint s4-0)))) + (+! (-> this depth) -1) + ) + ) + ) + 0 + (none) + ) + +(defmethod postprocess-data! ((this profile-array)) + "Create the collapsed summary of the collected data." + (dotimes (s5-0 2) + (let ((s3-0 (-> *profile-array* data s5-0)) + (s4-0 *profile-collapse*) + ) + (mem-copy! (&-> s3-0 type) (&-> (-> this data s5-0) type) #x4030) + (cond + ((zero? s5-0) + ((lambda ((arg0 profile-segment-array) (arg1 profile-collapse)) + (let ((v0-0 0)) + (dotimes (v1-0 48) + (set! (-> arg1 data v1-0 name) #f) + (set! (-> arg1 data v1-0 count) (the-as uint 0)) + (set! (-> arg1 data v1-0 vu-count) (the-as uint 0)) + (set! (-> arg1 data v1-0 depth) (the-as uint 0)) + (set! (-> arg1 data v1-0 start-time) 0) + (set! (-> arg1 data v1-0 end-time) 0) + ) + (dotimes (v1-3 (-> arg0 count)) + (let ((a2-15 (- (-> arg0 data v1-3 end-time) (-> arg0 data v1-3 start-time)))) + (let ((t0-0 (-> arg0 data v1-3 name))) + (dotimes (a3-5 v0-0) + (when (= (-> arg1 data a3-5 name) t0-0) + (+! (-> arg1 data a3-5 count) 1) + (set! (-> arg1 data a3-5 start-time) (the-as int (+ (-> arg1 data a3-5 code-time) a2-15))) + (goto cfg-11) + ) + ) + (set! (-> arg1 data v0-0 name) t0-0) + ) + (set! (-> arg1 data v0-0 count) (the-as uint 1)) + (set! (-> arg1 data v0-0 depth) (-> arg0 data v1-3 depth)) + (set! (-> arg1 data v0-0 start-time) a2-15) + ) + (set! (-> arg1 data v0-0 color) (-> arg0 data v1-3 color)) + (set! v0-0 (min 47 (+ v0-0 1))) + (label cfg-11) + ) + (set! (-> arg1 count) v0-0) + ) + (none) + ) + s3-0 + s4-0 + ) + ) + (else + (let ((v1-6 3) + (a0-5 (+ (-> s3-0 count) -1)) + ) + (while (>= a0-5 v1-6) + (let ((a1-4 (-> s3-0 data v1-6))) + (set! (-> a1-4 name) (-> *profile-spec-array* (-> *profile-translate-array* v1-6) name)) + (set! (-> a1-4 color) (-> *profile-spec-array* (-> *profile-translate-array* v1-6) color)) + (let ((a2-14 (- (-> a1-4 end-time) (-> a1-4 start-time))) + (a3-5 (-> a1-4 name)) + ) + (dotimes (a1-5 (-> s4-0 count)) + (when (= (-> s4-0 data a1-5 name) a3-5) + (+! (-> s4-0 data a1-5 vu-count) 1) + (set! (-> s4-0 data a1-5 end-time) (the-as int (+ (-> s4-0 data a1-5 vu-time) a2-14))) + (goto cfg-11) + ) + ) + ) + ) + (label cfg-11) + (+! v1-6 1) + ) + ) + (countdown (v1-9 (-> s3-0 count)) + (when (nonzero? (-> s3-0 data v1-9 end-time)) + (set! (-> s4-0 data 0 vu-count) (the-as uint 1)) + (set! (-> s4-0 data 0 end-time) (- (-> s3-0 data v1-9 end-time) (-> s3-0 data 0 start-time))) + (goto cfg-19) + ) + ) + ) + ) + ) + (label cfg-19) + ) + 0 + (none) + ) + +(defmethod draw-bars! ((this profile-array) (arg0 dma-buffer) (arg1 int)) + "Generate DMA data for drawing the profile bars." + (local-vars (sv-16 (function _varargs_ object)) (sv-32 (function _varargs_ object))) + (dma-buffer-add-gs-set arg0 + (alpha-1 (new 'static 'gs-alpha :b #x1 :d #x1)) + (zbuf-1 (new 'static 'gs-zbuf :zbp #x130 :psm (gs-psm ct24) :zmsk #x1)) + (test-1 (new 'static 'gs-test :zte #x1 :ztst (gs-ztest always))) + (pabe 0) + (clamp-1 (new 'static 'gs-clamp :wms (gs-tex-wrap-mode clamp) :wmt (gs-tex-wrap-mode clamp))) + (tex1-1 (new 'static 'gs-tex1 :mmag #x1 :mmin #x1)) + (texa (new 'static 'gs-texa :ta1 #x80)) + (texclut (new 'static 'gs-texclut :cbw #x4)) + (fogcol *fog-color*) + ) + (let ((v1-5 (* (+ *profile-x* (/ *profile-w* 2)) 16)) + (a0-9 (-> arg0 base)) + ) + (set! (-> (the-as (pointer uint128) a0-9) 0) (-> *profile-work* line-tmpl dma-vif quad)) + (set! (-> (the-as (pointer uint128) a0-9) 1) (-> *profile-work* line-tmpl quad 1)) + (set-vector! (the-as vector4w (&+ a0-9 32)) 64 64 64 64) + (set-vector! (the-as vector4w (&+ a0-9 48)) v1-5 #x7340 #xffffff 0) + (set-vector! (the-as vector4w (&+ a0-9 64)) v1-5 #x7580 #xffffff 0) + ) + (&+! (-> arg0 base) 80) + (dotimes (s3-0 2) + (let* ((v1-12 (-> this data s3-0)) + (a0-11 (-> v1-12 max-depth)) + (s2-1 (max 14 (* a0-11 2))) + ) + (set! *profile-y* (+ arg1 1840)) + (let ((a1-32 (-> arg0 base))) + (set! (-> (the-as (pointer uint128) a1-32) 0) (-> *profile-work* sprite-tmpl dma-vif quad)) + (set! (-> (the-as (pointer uint128) a1-32) 1) (-> *profile-work* sprite-tmpl quad 1)) + (set-vector! (the-as vector4w (&+ a1-32 32)) 64 64 64 64) + (set-vector! (the-as vector4w (&+ a1-32 48)) (* *profile-x* 16) (* *profile-y* 16) #xffffff 0) + (set-vector! + (the-as vector4w (&+ a1-32 64)) + (* (+ *profile-x* *profile-w*) 16) + (* (+ *profile-y* s2-1) 16) + #xffffff + 0 + ) + ) + (&+! (-> arg0 base) 80) + (let ((a0-12 (/ s2-1 a0-11))) + (dotimes (a1-36 (-> v1-12 count)) + (let ((a2-22 (-> v1-12 data a1-36))) + (when (< (-> a2-22 start-time) (-> a2-22 end-time)) + (let* ((t0-1 (* *ticks-per-frame* 2)) + (a3-15 (* (+ *profile-x* (/ (* (-> a2-22 start-time) *profile-w*) t0-1)) 16)) + (t0-4 (* (+ *profile-x* (/ (* (-> a2-22 end-time) *profile-w*) t0-1)) 16)) + (t3-1 (* (+ arg1 1840 (* (-> a2-22 depth) (the-as uint a0-12))) 16)) + (t1-7 (+ t3-1 (* a0-12 16))) + (t2-5 (-> arg0 base)) + ) + (set! (-> (the-as (pointer int128) t2-5) 0) (the-as int128 (-> *profile-work* sprite-tmpl dma-vif quad))) + (set! (-> (the-as (pointer int128) t2-5) 1) (the-as int128 (-> *profile-work* sprite-tmpl quad 1))) + (set-vector! + (the-as vector4w (&+ t2-5 32)) + (the int (* 1.9921875 (the float (-> a2-22 color r)))) + (the int (* 1.9921875 (the float (-> a2-22 color g)))) + (the int (* 1.9921875 (the float (-> a2-22 color b)))) + (the-as int (-> a2-22 color a)) + ) + (set-vector! (the-as vector4w (&+ t2-5 48)) a3-15 t3-1 #xffffff 0) + (set-vector! (the-as vector4w (&+ t2-5 64)) t0-4 t1-7 #xffffff 0) + ) + (&+! (-> arg0 base) 80) + ) + ) + ) + ) + (cond + ((zero? s3-0) + (let* ((s1-0 (-> v1-12 data 0 end-time)) + (f30-0 (* 100.0 (/ (the float s1-0) (the float *ticks-per-frame*)))) + ) + (cond + (*profile-ticks* + (let ((s0-0 draw-string-xy)) + (set! sv-16 format) + (let ((a0-16 (clear *temp-string*)) + (a1-37 "~5D") + ) + (sv-16 a0-16 a1-37 s1-0) + ) + (s0-0 + *temp-string* + arg0 + 488 + arg1 + (if (>= f30-0 100.0) + (font-color red) + (font-color default) + ) + (font-flags shadow right) + ) + ) + ) + (else + (let ((s1-1 draw-string-xy)) + (format (clear *temp-string*) "~5,,2f" f30-0) + (s1-1 + *temp-string* + arg0 + 488 + arg1 + (if (>= f30-0 100.0) + (font-color red) + (font-color default) + ) + (font-flags shadow right) + ) + ) + ) + ) + ) + ) + (else + (let ((s1-2 0)) + (countdown (a0-21 (-> v1-12 count)) + (when (nonzero? (-> v1-12 data a0-21 end-time)) + (set! s1-2 (- (-> v1-12 data a0-21 end-time) (-> v1-12 data 0 start-time))) + (goto cfg-23) + ) + ) + (label cfg-23) + (let ((f30-1 (* 100.0 (/ (the float s1-2) (the float *ticks-per-frame*))))) + (cond + (*profile-ticks* + (let ((s0-2 draw-string-xy)) + (set! sv-32 format) + (let ((a0-26 (clear *temp-string*)) + (a1-45 "~5D") + ) + (sv-32 a0-26 a1-45 s1-2) + ) + (s0-2 + *temp-string* + arg0 + 488 + arg1 + (if (>= f30-1 100.0) + (font-color red) + (font-color default) + ) + (font-flags shadow right) + ) + ) + ) + (else + (let ((s1-3 draw-string-xy)) + (format (clear *temp-string*) "~5,,2f" f30-1) + (s1-3 + *temp-string* + arg0 + 488 + arg1 + (if (>= f30-1 100.0) + (font-color red) + (font-color default) + ) + (font-flags shadow right) + ) + ) + ) + ) + ) + ) + ) + ) + (set! arg1 (+ s2-1 2 arg1)) + ) + ) + (none) + ) + +(defmethod draw-text! ((this profile-array)) + "Generate DMA data for drawing the profile information screen." + (let ((gp-0 *profile-collapse*)) + (dotimes (s5-0 (-> gp-0 count)) + (when (or (nonzero? (-> gp-0 data s5-0 count)) (nonzero? (-> gp-0 data s5-0 vu-count))) + (dotimes (s4-0 (the-as int (-> gp-0 data s5-0 depth))) + (format *stdcon* " ") + ) + (format *stdcon* "~o~s~0k" (-> gp-0 data s5-0 color) (symbol->string (-> gp-0 data s5-0 name))) + (if (nonzero? (-> gp-0 data s5-0 count)) + (format + *stdcon* + "~170h~5d~220h~5d~280h~5,,2f" + (-> gp-0 data s5-0 count) + (-> gp-0 data s5-0 code-time) + (* 100.0 (/ (the float (-> gp-0 data s5-0 code-time)) (the float *ticks-per-frame*))) + ) + ) + (if (nonzero? (-> gp-0 data s5-0 vu-count)) + (format + *stdcon* + "~338h~5d~388h~5d~448h~5,,2f" + (-> gp-0 data s5-0 vu-count) + (-> gp-0 data s5-0 vu-time) + (* 100.0 (/ (the float (-> gp-0 data s5-0 vu-time)) (the float *ticks-per-frame*))) + ) + ) + (format *stdcon* "~1k~%") + ) + ) + ) + 0 + (none) + ) diff --git a/test/decompiler/reference/jak3/decompiler-macros.gc b/test/decompiler/reference/jak3/decompiler-macros.gc index 0a4773a6f2..88d1627420 100644 --- a/test/decompiler/reference/jak3/decompiler-macros.gc +++ b/test/decompiler/reference/jak3/decompiler-macros.gc @@ -420,4 +420,253 @@ (defmacro mouse-hold? (&rest buttons) `(logtest? (mouse-hold) (mouse-buttons ,@buttons)) + ) + +(defmacro gs-reg-list (&rest reg-ids) + "Generate a giftag register descriptor list from reg-ids." + + (let ((reg-count (length reg-ids))) + (when (> (length reg-ids) 16) + (ferror "too many regs passed to gs-reg-list") + ) + (let ((list-to-splice '()) + (cur-lst reg-ids) + (i -1)) + + ;; this is questionable. + (while (and (not (null? cur-lst)) (< i 15)) + (push! list-to-splice (cons 'gif-reg-id (cons (car cur-lst) '()))) + (push! list-to-splice (string->symbol-format ":regs{}" (inc! i))) + (pop! cur-lst) + ) + + `(new 'static 'gif-tag-regs + ,@list-to-splice + ) + ) + #| ;; the opengoal compiler does not have enough constant propagation for this for now + (let ((i -1)) + + `(the-as gif-tag-regs (logior ,@(apply (lambda (x) + `(shl (the-as uint (gif-reg-id ,x)) ,(* 4 (inc! i))) + ) reg-ids) + )) + + )|# + ) + ) + +(defmacro dma-buffer-add-base-type (buf pkt dma-type &rest body) + "Base macro for adding stuff to a dma-buffer. Don't use this directly!" + + (with-gensyms (dma-buf) + `(let* ((,dma-buf ,buf) + (,pkt (the-as ,dma-type (-> ,dma-buf base)))) + + ,@body + + (set! (-> ,dma-buf base) (&+ (the-as pointer ,pkt) (size-of ,dma-type))) + + ) + ) + ) + +(defmacro dma-buffer-add-base-data (buf data-type forms) + "Base macro for adding data words to a dma-buffer. + Each form in forms is converted into data-type and added to the buffer. NO TYPE CHECKING is performed, so be careful!" + + (with-gensyms (dma-buf ptr) + `(let* ((,dma-buf ,buf) + (,ptr (the-as (pointer ,data-type) (-> ,dma-buf base)))) + + ,@(apply-i (lambda (x i) `(set! (-> ,ptr ,i) (the-as ,data-type ,x))) forms) + + (set! (-> ,dma-buf base) (&+ (the-as pointer ,ptr) (* ,(length forms) (size-of ,data-type)))) + + ) + ) + ) + + +(defmacro dma-buffer-add-cnt-vif2 (buf qwc vif0 vif1) + "Add a dma-packet to a dma-buffer. + The packet is made up of a 'cnt' DMAtag (transfer qwc qwords of data after the tag and continue from after that point) + and includes two vif-tags for vifcode, or something else if needed." + + (with-gensyms (pkt) + `(dma-buffer-add-base-type ,buf ,pkt dma-packet + + (set! (-> ,pkt dma) (new 'static 'dma-tag :id (dma-tag-id cnt) :qwc ,qwc)) + + (set! (-> ,pkt vif0) ,vif0) + (set! (-> ,pkt vif1) ,vif1) + + ) + ) + ) + +(defmacro dma-buffer-add-ref-vif2 (buf qwc addr vif0 vif1) + "Add a dma-packet to a dma-buffer. + The packet is made up of a 'cnt' DMAtag (transfer qwc qwords of data at addr and continue from after the tag) + and includes two vif-tags for vifcode, or something else if needed." + + (with-gensyms (pkt) + `(dma-buffer-add-base-type ,buf ,pkt dma-packet + + (set! (-> ,pkt dma) (new 'static 'dma-tag :id (dma-tag-id ref) :qwc ,qwc :addr (the-as int ,addr))) + + (set! (-> ,pkt vif0) ,vif0) + (set! (-> ,pkt vif1) ,vif1) + + ) + ) + ) + +(defmacro dma-buffer-add-ret (buf) + "Add a dma-packet to a dma-buffer. This packet simply does a DMA 'return' " + + (with-gensyms (pkt) + `(dma-buffer-add-base-type ,buf ,pkt dma-packet + + (set! (-> ,pkt dma) (new 'static 'dma-tag :id (dma-tag-id ret) :qwc 0)) + + (set! (-> ,pkt vif0) (new 'static 'vif-tag :cmd (vif-cmd nop))) + (set! (-> ,pkt vif1) (new 'static 'vif-tag :cmd (vif-cmd nop))) + + ) + ) + ) + +(defmacro dma-buffer-add-gif-tag (buf giftag gifregs) + "Add a giftag to a dma-buffer." + + (with-gensyms (pkt) + `(dma-buffer-add-base-type ,buf ,pkt gs-gif-tag + + (set! (-> ,pkt tag) ,giftag) + + (set! (-> ,pkt regs) ,gifregs) + + ) + ) + ) + +(defmacro dma-buffer-add-uint64 (buf &rest body) + "Add 64-bit words to a dma-buffer. See dma-buffer-add-base-data" + + `(dma-buffer-add-base-data ,buf uint64 ,body) + ) + +(defmacro dma-buffer-add-uint128 (buf &rest body) + "Add 128-bit words to a dma-buffer. See dma-buffer-add-base-data" + + `(dma-buffer-add-base-data ,buf uint128 ,body) + ) + +(defmacro dma-buffer-add-gs-set-flusha (buf &rest reg-list) + "Add a gif cnt dma packet to a dma-buffer for setting GS registers. Up to 16 can be set at once. + The packet runs the flusha command which waits for GIF transfer to end and VU1 microprogram to stop. + reg-list is a list of pairs where the car is the register name and the cadr is the value to be set for that register." + + (let ((reg-count (length reg-list)) + (qwc (+ (length reg-list) 1)) + (reg-names (apply first reg-list)) + (reg-datas (apply second reg-list)) + ) + `(begin + ;; dma tag + (dma-buffer-add-cnt-vif2 ,buf ,qwc + (new 'static 'vif-tag :cmd (vif-cmd flusha)) + (new 'static 'vif-tag :cmd (vif-cmd direct) :imm ,qwc) + ) + + ;; gif tag for editing gs regs + (dma-buffer-add-gif-tag ,buf (new 'static 'gif-tag64 :nloop 1 :eop 1 :nreg ,reg-count) + (gs-reg-list a+d a+d a+d a+d a+d a+d a+d a+d a+d a+d a+d a+d a+d a+d a+d a+d) + ) + + ;; gs regs + (dma-buffer-add-uint64 ,buf + ,@(apply2 (lambda (x) x) (lambda (x) `(gs-reg64 ,x)) reg-datas reg-names) + ) + ) + ) + ) + +(defmacro dma-buffer-add-gs-set (buf &rest reg-list) + "Add a gif cnt dma packet to a dma-buffer for setting GS registers. Up to 16 can be set at once. + reg-list is a list of pairs where the car is the register name and the cadr is the value to be set for that register." + + (let ((reg-count (length reg-list)) + (qwc (+ (length reg-list) 1)) + (reg-names (apply first reg-list)) + (reg-datas (apply second reg-list)) + ) + `(begin + ;; dma tag + (dma-buffer-add-cnt-vif2 ,buf ,qwc + (new 'static 'vif-tag :cmd (vif-cmd nop)) + (new 'static 'vif-tag :cmd (vif-cmd direct) :imm ,qwc) + ) + + ;; gif tag for editing gs regs + (dma-buffer-add-gif-tag ,buf (new 'static 'gif-tag64 :nloop 1 :eop 1 :nreg ,reg-count) + (gs-reg-list a+d a+d a+d a+d a+d a+d a+d a+d a+d a+d a+d a+d a+d a+d a+d a+d) + ) + + ;; gs regs + (dma-buffer-add-uint64 ,buf + ,@(apply2 (lambda (x) x) (lambda (x) `(gs-reg64 ,x)) reg-datas reg-names) + ) + ) + ) + ) + +(defmacro with-dma-bucket (bindings &rest body) + "Start a new dma-bucket in body that will be finished at the end. + The bindings are the dma-buffer, dma-bucket and bucket-id respectively." + + (let ((buf (first bindings)) + (bucket (second bindings)) + (bucket-id (third bindings)) + ) + + (with-gensyms (buf-start bucket-edge pkt) + `(let ((,buf-start (-> ,buf base))) + + ,@body + + ;; we end the chain with a next. The bucket system will patch the next chain to this, + ;; and then patch all the buckets togehter before sending the DMA. + (let ((,bucket-edge (the (pointer dma-tag) (-> ,buf base)))) + (let ((,pkt (the-as dma-packet (-> ,buf base)))) + + (set! (-> ,pkt dma) (new 'static 'dma-tag :id (dma-tag-id next))) + (set! (-> ,pkt vif0) (new 'static 'vif-tag :cmd (vif-cmd nop))) + (set! (-> ,pkt vif1) (new 'static 'vif-tag :cmd (vif-cmd nop))) + + (set! (-> ,buf base) (&+ (the-as pointer ,pkt) (size-of dma-packet))) + + ) + (dma-bucket-insert-tag ,bucket ,bucket-id + ,buf-start ;; the first thing in this chain, bucket will patch previous to this + ,bucket-edge ;; end of this chain (ptr to next tag) + ) + ) + ) + ) + + ) + ) + +(defmacro with-dma-buffer-add-bucket (bindings &key (bucket-group (-> (current-frame) bucket-group)) &rest body) + "Bind a dma-buffer to a variable and use it on a block to allow adding things to a new bucket. + usage: (with-dma-buffer-add-bucket ((buffer-name buffer) bucket-id) &rest body) + example: (with-dma-buffer-add-bucket ((buf (-> (current-frame) debug-buf)) (bucket-id debug-no-zbuf)) ...)" + + `(let ((,(caar bindings) ,(cadar bindings))) + (with-dma-bucket (,(caar bindings) ,bucket-group ,(cadr bindings)) + ,@body + ) + ) ) \ No newline at end of file diff --git a/test/decompiler/reference/jak3/engine/camera/camera-defs-h_REF.gc b/test/decompiler/reference/jak3/engine/camera/camera-defs-h_REF.gc new file mode 100644 index 0000000000..cc07c15a35 --- /dev/null +++ b/test/decompiler/reference/jak3/engine/camera/camera-defs-h_REF.gc @@ -0,0 +1,104 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type camera-bank +(deftype camera-bank (basic) + ((collide-move-rad float) + (joypad uint32) + (min-detectable-velocity float) + (attack-timeout time-frame) + (default-string-max-y meters) + (default-string-min-y meters) + (default-string-max-z meters) + (default-string-min-z meters) + (default-string-push-z meters) + (default-tilt-adjust degrees) + ) + ) + +;; definition for method 3 of type camera-bank +(defmethod inspect ((this camera-bank)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this (-> this type)) + (format #t "~1Tcollide-move-rad: ~f~%" (-> this collide-move-rad)) + (format #t "~1Tjoypad: ~D~%" (-> this joypad)) + (format #t "~1Tmin-detectable-velocity: ~f~%" (-> this min-detectable-velocity)) + (format #t "~1Tattack-timeout: ~D~%" (-> this attack-timeout)) + (format #t "~1Tdefault-string-max-y: (meters ~m)~%" (-> this default-string-max-y)) + (format #t "~1Tdefault-string-min-y: (meters ~m)~%" (-> this default-string-min-y)) + (format #t "~1Tdefault-string-max-z: (meters ~m)~%" (-> this default-string-max-z)) + (format #t "~1Tdefault-string-min-z: (meters ~m)~%" (-> this default-string-min-z)) + (format #t "~1Tdefault-string-push-z: (meters ~m)~%" (-> this default-string-push-z)) + (format #t "~1Tdefault-tilt-adjust: (deg ~r)~%" (-> this default-tilt-adjust)) + (label cfg-4) + this + ) + +;; definition for symbol *CAMERA-bank*, type camera-bank +(define *CAMERA-bank* (new 'static 'camera-bank + :collide-move-rad 1638.4 + :min-detectable-velocity 40.96 + :attack-timeout (seconds 0.25) + :default-string-max-y (meters 3) + :default-string-min-y (meters 1) + :default-string-max-z (meters 12.5) + :default-string-min-z (meters 5) + :default-string-push-z (meters 10) + :default-tilt-adjust (degrees -6.5000005) + ) + ) + +;; definition of type camera-master-bank +(deftype camera-master-bank (basic) + ((onscreen-head-height meters) + (onscreen-foot-height meters) + (target-height meters) + (up-move-to-pitch-ratio-in-air float) + (down-move-to-pitch-ratio-in-air float) + (up-move-to-pitch-on-ground float) + (down-move-to-pitch-on-ground float) + (pitch-off-blend float) + ) + ) + +;; definition for method 3 of type camera-master-bank +(defmethod inspect ((this camera-master-bank)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this (-> this type)) + (format #t "~1Tonscreen-head-height: (meters ~m)~%" (-> this onscreen-head-height)) + (format #t "~1Tonscreen-foot-height: (meters ~m)~%" (-> this onscreen-foot-height)) + (format #t "~1Ttarget-height: (meters ~m)~%" (-> this target-height)) + (format #t "~1Tup-move-to-pitch-ratio-in-air: ~f~%" (-> this up-move-to-pitch-ratio-in-air)) + (format #t "~1Tdown-move-to-pitch-ratio-in-air: ~f~%" (-> this down-move-to-pitch-ratio-in-air)) + (format #t "~1Tup-move-to-pitch-on-ground: ~f~%" (-> this up-move-to-pitch-on-ground)) + (format #t "~1Tdown-move-to-pitch-on-ground: ~f~%" (-> this down-move-to-pitch-on-ground)) + (format #t "~1Tpitch-off-blend: ~f~%" (-> this pitch-off-blend)) + (label cfg-4) + this + ) + +;; definition for symbol *CAMERA_MASTER-bank*, type camera-master-bank +(define *CAMERA_MASTER-bank* (new 'static 'camera-master-bank + :onscreen-head-height (meters 2.65) + :onscreen-foot-height (meters -0.5) + :target-height (meters 2.15) + :up-move-to-pitch-ratio-in-air 1.0 + :down-move-to-pitch-ratio-in-air 0.5 + :up-move-to-pitch-on-ground 0.9 + :down-move-to-pitch-on-ground 0.9 + :pitch-off-blend 0.5 + ) + ) + +;; failed to figure out what this is: +0 + + + + diff --git a/test/decompiler/reference/jak3/engine/game/settings-h_REF.gc b/test/decompiler/reference/jak3/engine/game/settings-h_REF.gc new file mode 100644 index 0000000000..2ded36aa6e --- /dev/null +++ b/test/decompiler/reference/jak3/engine/game/settings-h_REF.gc @@ -0,0 +1,679 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type user-setting-data +(deftype user-setting-data (structure) + ((border-mode symbol) + (process-mask process-mask) + (unknown-int32 int32) + (language language-enum) + (movie (pointer process) :offset 32) + (talking (pointer process)) + (spooling (pointer process)) + (hint (pointer process)) + (ambient (pointer process)) + (video-mode symbol) + (aspect-ratio symbol) + (auto-save symbol :offset 64) + (bg-r float) + (bg-g float) + (bg-b float) + (bg-a float) + (bg-a-speed float) + (bg-a-force float) + (blur-a float) + (blur-a-speed float) + (allow-progress symbol) + (allow-pause symbol) + (movie-name symbol :offset 120) + (weather symbol) + (task-mask task-mask :offset 140) + (duck symbol :offset 148) + (attack symbol) + (gun symbol) + (board symbol) + (jump symbol) + (speed-mult float) + (features uint64) + (vehicles uint64) + (sfx-volume float) + (sfx-volume-movie float) + (music-volume float) + (music-volume-movie float) + (dialog-volume float) + (dialog-volume-talker float) + (ambient-volume float) + (ambient-volume-movie float) + (dynamic-ambient-volume float) + (talker-volume float) + (sound-flava uint8) + (sound-flava-priority float) + (mode-sound-bank uint32) + (sound-excitement float) + (sound-reverb float) + (stereo-mode int32) + (music symbol) + (sound-stinger int32) + (spool-anim spool-anim) + (sound-mode uint32) + (task-manager (pointer process)) + (task symbol) + (airlock symbol) + (minimap uint32) + (sound-tune uint32) + (allow-continue symbol) + (subtitle symbol :offset 304) + (doorway symbol) + (gem symbol) + (half-speed symbol) + (gun-buoy symbol) + (double-jump symbol) + (pilot symbol) + (pilot-exit symbol) + (pilot-death basic) + (speech-control symbol) + (vehicle-hijacking symbol) + (darkjak symbol) + (lightjak basic) + (endlessfall symbol) + (rain float) + (snow float) + (exclusive-load symbol) + (render symbol) + (allow-timeout symbol) + (mirror symbol) + (movie-skip-frame float) + (allow-blackout symbol) + (race-minimap int32) + (beard symbol) + (ignore-target symbol) + (subtitle-language uint8) + (sound-bank-load symbol) + (allow-error symbol) + (under-water-pitch-mod float) + (slow-time float) + (restart-info basic :offset 428) + (fail-info basic) + (death-info basic) + (quit-info basic) + (extra-bank-count uint32) + (extra-bank pair 3) + (borrow-count uint32) + (borrow pair 3) + (exclusive-task-count uint32) + (exclusive-task int32 3) + (level-trans-time int32) + (scarf float) + (goggles float) + (board-trail basic) + (letterbox float :offset 572) + (letterbox-speed float) + (borrow-city-count uint32 :offset 620) + (borrow-city pair 3) + (audio-language language-enum :offset 748) + (special-volume float :offset 796) + (pad uint8 108 :offset 800) + ) + (:methods + (user-setting-data-method-9 (_type_ engine engine-pers engine) user-setting-data) + (user-setting-data-method-10 (_type_ object symbol float uint) user-setting-data) + ) + ) + +;; definition for method 3 of type user-setting-data +(defmethod inspect ((this user-setting-data)) + (when (not this) + (set! this this) + (goto cfg-79) + ) + (format #t "[~8x] ~A~%" this 'user-setting-data) + (format #t "~1Tborder-mode: ~A~%" (-> this border-mode)) + (format #t "~1Tprocess-mask: #x~X~%" (-> this process-mask)) + (let ((t9-3 format) + (a0-4 #t) + (a1-3 "~1Tlanguage: #x~X : ~S~%") + (a2-3 (-> this language)) + (v1-2 (-> this language)) + ) + (t9-3 a0-4 a1-3 a2-3 (cond + ((= v1-2 (language-enum russian)) + "russian" + ) + ((= v1-2 (language-enum english)) + "english" + ) + ((= v1-2 (language-enum uk-english)) + "uk-english" + ) + ((= v1-2 (language-enum french)) + "french" + ) + ((= v1-2 (language-enum korean)) + "korean" + ) + ((= v1-2 (language-enum german)) + "german" + ) + ((= v1-2 (language-enum dutch)) + "dutch" + ) + ((= v1-2 (language-enum portuguese)) + "portuguese" + ) + ((= v1-2 (language-enum spanish)) + "spanish" + ) + ((= v1-2 (language-enum commentary)) + "commentary" + ) + ((= v1-2 (language-enum italian)) + "italian" + ) + ((= v1-2 (language-enum japanese)) + "japanese" + ) + (else + "*unknown*" + ) + ) + ) + ) + (format #t "~1Tmovie: ~A~%" (ppointer->process (-> this movie))) + (format #t "~1Ttalking: ~A~%" (ppointer->process (-> this talking))) + (format #t "~1Tspooling: ~A~%" (ppointer->process (-> this spooling))) + (format #t "~1Thint: ~A~%" (ppointer->process (-> this hint))) + (format #t "~1Tambient: ~A~%" (ppointer->process (-> this ambient))) + (format #t "~1Tvideo-mode: ~A~%" (-> this video-mode)) + (format #t "~1Taspect-ratio: ~A~%" (-> this aspect-ratio)) + (format #t "~1Tauto-save: ~A~%" (-> this auto-save)) + (format #t "~1Tbg-r: ~f~%" (-> this bg-r)) + (format #t "~1Tbg-g: ~f~%" (-> this bg-g)) + (format #t "~1Tbg-b: ~f~%" (-> this bg-b)) + (format #t "~1Tbg-a: ~f~%" (-> this bg-a)) + (format #t "~1Tbg-a-speed: ~f~%" (-> this bg-a-speed)) + (format #t "~1Tbg-a-force: ~f~%" (-> this bg-a-force)) + (format #t "~1Tblur-a: ~f~%" (-> this blur-a)) + (format #t "~1Tblur-a-speed: ~f~%" (-> this blur-a-speed)) + (format #t "~1Tallow-progress: ~A~%" (-> this allow-progress)) + (format #t "~1Tallow-pause: ~A~%" (-> this allow-pause)) + (format #t "~1Tmovie-name: ~A~%" (-> this movie-name)) + (format #t "~1Tweather: ~A~%" (-> this weather)) + (format #t "~1Ttask-mask: #x~X : (task-mask " (-> this task-mask)) + (let ((s5-0 (-> this task-mask))) + (if (= (logand s5-0 (task-mask task0)) (task-mask task0)) + (format #t "task0 ") + ) + (if (= (logand s5-0 (task-mask task2)) (task-mask task2)) + (format #t "task2 ") + ) + (if (= (logand s5-0 (task-mask task4)) (task-mask task4)) + (format #t "task4 ") + ) + (if (= (logand s5-0 (task-mask task6)) (task-mask task6)) + (format #t "task6 ") + ) + (if (= (logand s5-0 (task-mask ctywide)) (task-mask ctywide)) + (format #t "ctywide ") + ) + (if (= (logand s5-0 (task-mask never)) (task-mask never)) + (format #t "never ") + ) + (if (= (logand (task-mask movie1) s5-0) (task-mask movie1)) + (format #t "movie1 ") + ) + (if (= (logand s5-0 (task-mask vehicle)) (task-mask vehicle)) + (format #t "vehicle ") + ) + (if (= (logand s5-0 (task-mask dummy1)) (task-mask dummy1)) + (format #t "dummy1 ") + ) + (if (= (logand s5-0 (task-mask primary0)) (task-mask primary0)) + (format #t "primary0 ") + ) + (if (= (logand s5-0 (task-mask task1)) (task-mask task1)) + (format #t "task1 ") + ) + (if (= (logand s5-0 (task-mask task3)) (task-mask task3)) + (format #t "task3 ") + ) + (if (= (logand s5-0 (task-mask task5)) (task-mask task5)) + (format #t "task5 ") + ) + (if (= (logand s5-0 (task-mask task7)) (task-mask task7)) + (format #t "task7 ") + ) + (if (= (logand (task-mask movie2) s5-0) (task-mask movie2)) + (format #t "movie2 ") + ) + (if (= (logand s5-0 (task-mask done)) (task-mask done)) + (format #t "done ") + ) + (if (= (logand s5-0 (task-mask special)) (task-mask special)) + (format #t "special ") + ) + (if (= (logand (task-mask movie0) s5-0) (task-mask movie0)) + (format #t "movie0 ") + ) + (if (= (logand s5-0 (task-mask dummy0)) (task-mask dummy0)) + (format #t "dummy0 ") + ) + ) + (format #t ")~%") + (format #t "~1Tduck: ~A~%" (-> this duck)) + (format #t "~1Tattack: ~A~%" (-> this attack)) + (format #t "~1Tgun: ~A~%" (-> this gun)) + (format #t "~1Tboard: ~A~%" (-> this board)) + (format #t "~1Tjump: ~A~%" (-> this jump)) + (format #t "~1Tspeed-mult: ~f~%" (-> this speed-mult)) + (format #t "~1Tfeatures: ~D~%" (-> this features)) + (format #t "~1Tvehicles: ~D~%" (-> this vehicles)) + (format #t "~1Tsfx-volume: ~f~%" (-> this sfx-volume)) + (format #t "~1Tsfx-volume-movie: ~f~%" (-> this sfx-volume-movie)) + (format #t "~1Tmusic-volume: ~f~%" (-> this music-volume)) + (format #t "~1Tmusic-volume-movie: ~f~%" (-> this music-volume-movie)) + (format #t "~1Tdialog-volume: ~f~%" (-> this dialog-volume)) + (format #t "~1Tdialog-volume-talker: ~f~%" (-> this dialog-volume-talker)) + (format #t "~1Tambient-volume: ~f~%" (-> this ambient-volume)) + (format #t "~1Tambient-volume-movie: ~f~%" (-> this ambient-volume-movie)) + (format #t "~1Tdynamic-ambient-volume: ~f~%" (-> this dynamic-ambient-volume)) + (format #t "~1Ttalker-volume: ~f~%" (-> this talker-volume)) + (format #t "~1Tsound-flava: ~D~%" (-> this sound-flava)) + (format #t "~1Tsound-flava-priority: ~f~%" (-> this sound-flava-priority)) + (format #t "~1Tmode-sound-bank: ~A~%" (-> this mode-sound-bank)) + (format #t "~1Tsound-excitement: ~f~%" (-> this sound-excitement)) + (format #t "~1Tsound-reverb: ~f~%" (-> this sound-reverb)) + (format #t "~1Tstereo-mode: ~D~%" (-> this stereo-mode)) + (format #t "~1Tmusic: ~A~%" (-> this music)) + (format #t "~1Tsound-stinger: ~D~%" (-> this sound-stinger)) + (format #t "~1Tspool-anim: ~A~%" (-> this spool-anim)) + (format #t "~1Tsound-mode: ~D~%" (-> this sound-mode)) + (format #t "~1Ttask-manager: ~A~%" (ppointer->process (-> this task-manager))) + (format #t "~1Ttask: ~A~%" (-> this task)) + (format #t "~1Tairlock: ~A~%" (-> this airlock)) + (format #t "~1Tminimap: ~D~%" (-> this minimap)) + (format #t "~1Tsound-tune: ~D~%" (-> this sound-tune)) + (format #t "~1Tallow-continue: ~A~%" (-> this allow-continue)) + (format #t "~1Tsubtitle: ~A~%" (-> this subtitle)) + (format #t "~1Tdoorway: ~A~%" (-> this doorway)) + (format #t "~1Tgem: ~A~%" (-> this gem)) + (format #t "~1Thalf-speed: ~A~%" (-> this half-speed)) + (format #t "~1Tgun-buoy: ~A~%" (-> this gun-buoy)) + (format #t "~1Tdouble-jump: ~A~%" (-> this double-jump)) + (format #t "~1Tpilot: ~A~%" (-> this pilot)) + (format #t "~1Tpilot-exit: ~A~%" (-> this pilot-exit)) + (format #t "~1Tpilot-death: ~A~%" (-> this pilot-death)) + (format #t "~1Tspeech-control: ~A~%" (-> this speech-control)) + (format #t "~1Tvehicle-hijacking: ~A~%" (-> this vehicle-hijacking)) + (format #t "~1Tdarkjak: ~A~%" (-> this darkjak)) + (format #t "~1Tlightjak: ~A~%" (-> this lightjak)) + (format #t "~1Tendlessfall: ~A~%" (-> this endlessfall)) + (format #t "~1Train: ~f~%" (-> this rain)) + (format #t "~1Tsnow: ~f~%" (-> this snow)) + (format #t "~1Texclusive-load: ~A~%" (-> this exclusive-load)) + (format #t "~1Trender: ~A~%" (-> this render)) + (format #t "~1Tallow-timeout: ~A~%" (-> this allow-timeout)) + (format #t "~1Tmirror: ~A~%" (-> this mirror)) + (format #t "~1Tmovie-skip-frame: ~f~%" (-> this movie-skip-frame)) + (format #t "~1Tallow-blackout: ~A~%" (-> this allow-blackout)) + (format #t "~1Trace-minimap: ~D~%" (-> this race-minimap)) + (format #t "~1Tbeard: ~A~%" (-> this beard)) + (format #t "~1Tignore-target: ~A~%" (-> this ignore-target)) + (format #t "~1Tsubtitle-language: ~D~%" (-> this subtitle-language)) + (format #t "~1Tsound-bank-load: ~A~%" (-> this sound-bank-load)) + (format #t "~1Tallow-error: ~A~%" (-> this allow-error)) + (format #t "~1Tunder-water-pitch-mod: ~f~%" (-> this under-water-pitch-mod)) + (format #t "~1Tslow-time: ~f~%" (-> this slow-time)) + (format #t "~1Trestart-info: ~A~%" (-> this restart-info)) + (format #t "~1Tfail-info: ~A~%" (-> this fail-info)) + (format #t "~1Tdeath-info: ~A~%" (-> this death-info)) + (format #t "~1Tquit-info: ~A~%" (-> this quit-info)) + (format #t "~1Textra-bank-count: ~D~%" (-> this extra-bank-count)) + (format #t "~1Textra-bank[3] @ #x~X~%" (-> this extra-bank)) + (format #t "~1Tborrow-count: ~D~%" (-> this borrow-count)) + (format #t "~1Tborrow[3] @ #x~X~%" (-> this borrow)) + (format #t "~1Texclusive-task-count: ~D~%" (-> this exclusive-task-count)) + (format #t "~1Texclusive-task[3] @ #x~X~%" (-> this exclusive-task)) + (format #t "~1Tlevel-trans-time: ~D~%" (-> this level-trans-time)) + (format #t "~1Tscarf: ~f~%" (-> this scarf)) + (format #t "~1Tgoggles: ~f~%" (-> this goggles)) + (format #t "~1Tboard-trail: ~A~%" (-> this board-trail)) + (format #t "~1Tletterbox: ~f~%" (-> this letterbox)) + (format #t "~1Tletterbox-speed: ~f~%" (-> this letterbox-speed)) + (format #t "~1Tborrow-city-count: ~D~%" (-> this borrow-city-count)) + (format #t "~1Tborrow-city[3] @ #x~X~%" (-> this borrow-city)) + (format #t "~1Taudio-language: ~D~%" (-> this audio-language)) + (format #t "~1Tspecial-volume: ~f~%" (-> this special-volume)) + (label cfg-79) + this + ) + +;; definition of type cam-setting-data +(deftype cam-setting-data (structure) + ((fov degrees) + (pov-handle handle :offset 16) + (pov-bone int32) + (pov-offset vector :inline) + (string-default symbol) + (string-max-length meters) + (string-min-length meters) + (string-max-height meters) + (string-min-height meters) + (string-cliff-height meters) + (string-camera-floor meters) + (string-camera-ceiling meters) + (gun-max-height meters) + (gun-min-height meters) + (string-local-down vector :inline) + (slave-options cam-slave-options) + (matrix-blend-max-angle degrees) + (matrix-blend-max-partial float) + (string-spline-max-move meters) + (string-spline-accel meters) + (string-spline-max-move-player meters) + (string-spline-accel-player meters) + (string-startup-vector vector :inline) + (use-string-startup-vector symbol) + (look-at-point vector :inline) + (use-look-at-point symbol) + (target-height meters) + (foot-offset meters) + (head-offset meters) + (teleport-on-entity-change symbol) + (entity-name string) + (cam-slope string) + (entity-or-mode-changed symbol) + (master-options cam-master-options) + (entity-mask uint32) + (mode-name symbol) + (real-entity-name string) + (cam-mode symbol) + (interp-time uint32) + (no-intro symbol) + (use-point-of-interest symbol) + (point-of-interest vector :inline) + (handle-of-interest handle) + (mouse-tumble-point vector :inline) + (use-mouse-tumble-point symbol) + (mouse-input symbol) + (cpad1-skip-buttons symbol) + (butt-handle handle) + (butt-angle float) + (extra-follow-height float) + (interp-time-priority uint32) + (string-max-length-default symbol) + (string-min-length-default symbol) + (string-max-height-default symbol) + (string-min-height-default symbol) + (flip-vertical symbol) + (flip-horizontal symbol) + (fov-priority float :offset 384) + (dummy object 98) + ) + (:methods + (cam-setting-data-method-9 (_type_ engine engine-pers engine) _type_) + (cam-setting-data-method-10 (_type_ object (pointer process) float int) _type_) + ) + ) + +;; definition for method 3 of type cam-setting-data +(defmethod inspect ((this cam-setting-data)) + (when (not this) + (set! this this) + (goto cfg-76) + ) + (format #t "[~8x] ~A~%" this 'cam-setting-data) + (format #t "~1Tfov: (deg ~r)~%" (-> this fov)) + (format #t "~1Tpov-handle: ~D~%" (-> this pov-handle)) + (format #t "~1Tpov-bone: ~D~%" (-> this pov-bone)) + (format #t "~1Tpov-offset: ~`vector`P~%" (-> this pov-offset)) + (format #t "~1Tstring-default: ~`boolean`P~%" (-> this string-default)) + (format #t "~1Tstring-max-length: (meters ~m)~%" (-> this string-max-length)) + (format #t "~1Tstring-min-length: (meters ~m)~%" (-> this string-min-length)) + (format #t "~1Tstring-max-height: (meters ~m)~%" (-> this string-max-height)) + (format #t "~1Tstring-min-height: (meters ~m)~%" (-> this string-min-height)) + (format #t "~1Tstring-cliff-height: (meters ~m)~%" (-> this string-cliff-height)) + (format #t "~1Tstring-camera-floor: (meters ~m)~%" (-> this string-camera-floor)) + (format #t "~1Tstring-camera-ceiling: (meters ~m)~%" (-> this string-camera-ceiling)) + (format #t "~1Tgun-max-height: (meters ~m)~%" (-> this gun-max-height)) + (format #t "~1Tgun-min-height: (meters ~m)~%" (-> this gun-min-height)) + (format #t "~1Tstring-local-down: ~`vector`P~%" (-> this string-local-down)) + (format #t "~1Tslave-options: #x~X : (cam-slave-options " (-> this slave-options)) + (let ((s5-0 (-> this slave-options))) + (if (= (logand s5-0 (cam-slave-options SAME_SIDE)) (cam-slave-options SAME_SIDE)) + (format #t "SAME_SIDE ") + ) + (if (= (logand (cam-slave-options GUN_CAM) s5-0) (cam-slave-options GUN_CAM)) + (format #t "GUN_CAM ") + ) + (if (= (logand (cam-slave-options BOMBBOT) s5-0) (cam-slave-options BOMBBOT)) + (format #t "BOMBBOT ") + ) + (if (= (logand s5-0 (cam-slave-options STICKY_ANGLE)) (cam-slave-options STICKY_ANGLE)) + (format #t "STICKY_ANGLE ") + ) + (if (= (logand s5-0 (cam-slave-options FIND_HIDDEN_TARGET)) (cam-slave-options FIND_HIDDEN_TARGET)) + (format #t "FIND_HIDDEN_TARGET ") + ) + (if (= (logand (cam-slave-options RAPID_TRACKING) s5-0) (cam-slave-options RAPID_TRACKING)) + (format #t "RAPID_TRACKING ") + ) + (if (= (logand s5-0 (cam-slave-options SHRINK_MAX_ANGLE)) (cam-slave-options SHRINK_MAX_ANGLE)) + (format #t "SHRINK_MAX_ANGLE ") + ) + (if (= (logand s5-0 (cam-slave-options JUMP_PITCHES)) (cam-slave-options JUMP_PITCHES)) + (format #t "JUMP_PITCHES ") + ) + (if (= (logand s5-0 (cam-slave-options LINE_OF_SIGHT)) (cam-slave-options LINE_OF_SIGHT)) + (format #t "LINE_OF_SIGHT ") + ) + (if (= (logand s5-0 (cam-slave-options PLAYER_MOVING_CAMERA)) (cam-slave-options PLAYER_MOVING_CAMERA)) + (format #t "PLAYER_MOVING_CAMERA ") + ) + (if (= (logand (cam-slave-options ALLOW_SHIFT_BUTTONS) s5-0) (cam-slave-options ALLOW_SHIFT_BUTTONS)) + (format #t "ALLOW_SHIFT_BUTTONS ") + ) + (if (= (logand s5-0 (cam-slave-options NO_ROTATE)) (cam-slave-options NO_ROTATE)) + (format #t "NO_ROTATE ") + ) + (if (= (logand (cam-slave-options WIDE_FOV) s5-0) (cam-slave-options WIDE_FOV)) + (format #t "WIDE_FOV ") + ) + (if (= (logand s5-0 (cam-slave-options MOVE_SPHERICAL)) (cam-slave-options MOVE_SPHERICAL)) + (format #t "MOVE_SPHERICAL ") + ) + (if (= (logand s5-0 (cam-slave-options DRAG)) (cam-slave-options DRAG)) + (format #t "DRAG ") + ) + (if (= (logand s5-0 (cam-slave-options MOVEMENT_BLOCKED)) (cam-slave-options MOVEMENT_BLOCKED)) + (format #t "MOVEMENT_BLOCKED ") + ) + (if (= (logand (cam-slave-options BLOCK_RIGHT_STICK) s5-0) (cam-slave-options BLOCK_RIGHT_STICK)) + (format #t "BLOCK_RIGHT_STICK ") + ) + (if (= (logand s5-0 (cam-slave-options COLLIDE)) (cam-slave-options COLLIDE)) + (format #t "COLLIDE ") + ) + (if (= (logand s5-0 (cam-slave-options ALLOW_Z_ROT)) (cam-slave-options ALLOW_Z_ROT)) + (format #t "ALLOW_Z_ROT ") + ) + (if (= (logand (cam-slave-options JUMP_LAG) s5-0) (cam-slave-options JUMP_LAG)) + (format #t "JUMP_LAG ") + ) + (if (= (logand s5-0 (cam-slave-options BIKE_MODE)) (cam-slave-options BIKE_MODE)) + (format #t "BIKE_MODE ") + ) + (if (= (logand (cam-slave-options EASE_SPLINE_IDX) s5-0) (cam-slave-options EASE_SPLINE_IDX)) + (format #t "EASE_SPLINE_IDX ") + ) + (if (= (logand s5-0 (cam-slave-options GOTO_GOOD_POINT)) (cam-slave-options GOTO_GOOD_POINT)) + (format #t "GOTO_GOOD_POINT ") + ) + (if (= (logand s5-0 (cam-slave-options BUTT_CAM)) (cam-slave-options BUTT_CAM)) + (format #t "BUTT_CAM ") + ) + (if (= (logand (cam-slave-options VERTICAL_FOLLOW_MATCHES_CAMERA) s5-0) + (cam-slave-options VERTICAL_FOLLOW_MATCHES_CAMERA) + ) + (format #t "VERTICAL_FOLLOW_MATCHES_CAMERA ") + ) + (if (= (logand (cam-slave-options HAVE_BUTT_HANDLE) s5-0) (cam-slave-options HAVE_BUTT_HANDLE)) + (format #t "HAVE_BUTT_HANDLE ") + ) + ) + (format #t ")~%") + (format #t "~1Tmatrix-blend-max-angle: (deg ~r)~%" (-> this matrix-blend-max-angle)) + (format #t "~1Tmatrix-blend-max-partial: ~f~%" (-> this matrix-blend-max-partial)) + (format #t "~1Tstring-spline-max-move: (meters ~m)~%" (-> this string-spline-max-move)) + (format #t "~1Tstring-spline-accel: (meters ~m)~%" (-> this string-spline-accel)) + (format #t "~1Tstring-spline-max-move-player: (meters ~m)~%" (-> this string-spline-max-move-player)) + (format #t "~1Tstring-spline-accel-player: (meters ~m)~%" (-> this string-spline-accel-player)) + (format #t "~1Tstring-startup-vector: ~`vector`P~%" (-> this string-startup-vector)) + (format #t "~1Tuse-string-startup-vector: ~A~%" (-> this use-string-startup-vector)) + (format #t "~1Tlook-at-point: ~`vector`P~%" (-> this look-at-point)) + (format #t "~1Tuse-look-at-point: ~A~%" (-> this use-look-at-point)) + (format #t "~1Ttarget-height: (meters ~m)~%" (-> this target-height)) + (format #t "~1Tfoot-offset: (meters ~m)~%" (-> this foot-offset)) + (format #t "~1Thead-offset: (meters ~m)~%" (-> this head-offset)) + (format #t "~1Tteleport-on-entity-change: ~`boolean`P~%" (-> this teleport-on-entity-change)) + (format #t "~1Tentity-name: ~`string`P~%" (-> this entity-name)) + (format #t "~1Tcam-slope: ~`string`P~%" (-> this cam-slope)) + (format #t "~1Tentity-or-mode-changed: ~`boolean`P~%" (-> this entity-or-mode-changed)) + (format #t "~1Tmaster-options: #x~X : (cam-master-options " (-> this master-options)) + (let ((s5-1 (-> this master-options))) + (if (= (logand s5-1 (cam-master-options IMMEDIATE_STRING_MIN_MAX)) (cam-master-options IMMEDIATE_STRING_MIN_MAX)) + (format #t "IMMEDIATE_STRING_MIN_MAX ") + ) + (if (= (logand s5-1 (cam-master-options IN_BASE_REGION)) (cam-master-options IN_BASE_REGION)) + (format #t "IN_BASE_REGION ") + ) + (if (= (logand s5-1 (cam-master-options FLIP_COMBINER)) (cam-master-options FLIP_COMBINER)) + (format #t "FLIP_COMBINER ") + ) + (if (= (logand s5-1 (cam-master-options SET_COMBINER_AXIS)) (cam-master-options SET_COMBINER_AXIS)) + (format #t "SET_COMBINER_AXIS ") + ) + (if (= (logand s5-1 (cam-master-options USE_L1_R1)) (cam-master-options USE_L1_R1)) + (format #t "USE_L1_R1 ") + ) + (if (= (logand s5-1 (cam-master-options IGNORE_ANALOG)) (cam-master-options IGNORE_ANALOG)) + (format #t "IGNORE_ANALOG ") + ) + (if (= (logand s5-1 (cam-master-options BLOCK_RIGHT_STICK)) (cam-master-options BLOCK_RIGHT_STICK)) + (format #t "BLOCK_RIGHT_STICK ") + ) + (if (= (logand s5-1 (cam-master-options READ_BUTTONS)) (cam-master-options READ_BUTTONS)) + (format #t "READ_BUTTONS ") + ) + (if (= (logand s5-1 (cam-master-options HAVE_TARGET)) (cam-master-options HAVE_TARGET)) + (format #t "HAVE_TARGET ") + ) + (if (= (logand s5-1 (cam-master-options HAVE_EASE_TO_POS)) (cam-master-options HAVE_EASE_TO_POS)) + (format #t "HAVE_EASE_TO_POS ") + ) + ) + (format #t ")~%") + (format #t "~1Tentity-mask: ~D~%" (-> this entity-mask)) + (format #t "~1Tmode-name: ~A~%" (-> this mode-name)) + (format #t "~1Treal-entity-name: ~`string`P~%" (-> this real-entity-name)) + (format #t "~1Tcam-mode: ~A~%" (-> this cam-mode)) + (format #t "~1Tinterp-time: ~D~%" (-> this interp-time)) + (format #t "~1Tno-intro: ~A~%" (-> this no-intro)) + (format #t "~1Tuse-point-of-interest: ~A~%" (-> this use-point-of-interest)) + (format #t "~1Tpoint-of-interest: ~`vector`P~%" (-> this point-of-interest)) + (format #t "~1Thandle-of-interest: ~D~%" (-> this handle-of-interest)) + (format #t "~1Tmouse-tumble-point: ~`vector`P~%" (-> this mouse-tumble-point)) + (format #t "~1Tuse-mouse-tumble-point: ~A~%" (-> this use-mouse-tumble-point)) + (format #t "~1Tmouse-input: ~A~%" (-> this mouse-input)) + (format #t "~1Tcpad1-skip-buttons: ~A~%" (-> this cpad1-skip-buttons)) + (format #t "~1Tbutt-handle: ~D~%" (-> this butt-handle)) + (format #t "~1Tbutt-angle: ~f~%" (-> this butt-angle)) + (format #t "~1Textra-follow-height: ~f~%" (-> this extra-follow-height)) + (format #t "~1Tinterp-time-priority: ~D~%" (-> this interp-time-priority)) + (format #t "~1Tstring-max-length-default: ~A~%" (-> this string-max-length-default)) + (format #t "~1Tstring-min-length-default: ~A~%" (-> this string-min-length-default)) + (format #t "~1Tstring-max-height-default: ~A~%" (-> this string-max-height-default)) + (format #t "~1Tstring-min-height-default: ~A~%" (-> this string-min-height-default)) + (format #t "~1Tflip-vertical: ~A~%" (-> this flip-vertical)) + (format #t "~1Tflip-horizontal: ~A~%" (-> this flip-horizontal)) + (format #t "~1Tfov-priority: ~f~%" (-> this fov-priority)) + (format #t "~1Tdummy[98] @ #x~X~%" (-> this dummy)) + (label cfg-76) + this + ) + +;; definition of type setting-control +(deftype setting-control (basic) + ((user-current user-setting-data :inline) + (user-target user-setting-data :inline) + (user-default user-setting-data :inline) + (cam-current cam-setting-data :inline) + (cam-target cam-setting-data :inline) + (cam-default cam-setting-data :inline) + (engine engine) + (engine-pers engine-pers) + (engine-hi engine) + (sound-stinger-time time-frame) + (sound-stinger-change-time time-frame 4) + (sound-excitement-change-time time-frame) + (sound-excitement-targ float) + (sound-excitement-level uint32) + ) + (:methods + (new (symbol type int) _type_) + (add-setting (_type_ process symbol object object object) none) + (persist-with-delay (_type_ symbol time-frame symbol symbol float int) none) + (set-setting (_type_ process symbol object object object) none) + (remove-setting (_type_ process symbol) none) + (kill-persister (_type_ engine-pers object) none) + (setting-control-method-14 (_type_ object) connectable) + (remove-setting-by-arg0 (_type_ object) none) + (set-setting-by-param (_type_ symbol object object object) connection) + (setting-control-method-17 () none) + (setting-control-method-18 () none) + (setting-control-method-19 () none) + ) + ) + +;; definition for method 3 of type setting-control +(defmethod inspect ((this setting-control)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this (-> this type)) + (format #t "~1Tuser-current: #~%" (-> this user-current)) + (format #t "~1Tuser-target: #~%" (-> this user-target)) + (format #t "~1Tuser-default: #~%" (-> this user-default)) + (format #t "~1Tcam-current: #~%" (-> this cam-current)) + (format #t "~1Tcam-target: #~%" (-> this cam-target)) + (format #t "~1Tcam-default: #~%" (-> this cam-default)) + (format #t "~1Tengine: ~A~%" (-> this engine)) + (format #t "~1Tengine-pers: ~A~%" (-> this engine-pers)) + (format #t "~1Tengine-hi: ~A~%" (-> this engine-hi)) + (format #t "~1Tsound-stinger-time: ~D~%" (-> this sound-stinger-time)) + (format #t "~1Tsound-stinger-change-time[4] @ #x~X~%" (-> this sound-stinger-change-time)) + (format #t "~1Tsound-excitement-change-time: ~D~%" (-> this sound-excitement-change-time)) + (format #t "~1Tsound-excitement-targ: ~f~%" (-> this sound-excitement-targ)) + (format #t "~1Tsound-excitement-level: ~D~%" (-> this sound-excitement-level)) + (label cfg-4) + this + ) + +;; definition for method 0 of type setting-control +(defmethod new setting-control ((allocation symbol) (type-to-make type) (arg0 int)) + (let ((s4-0 (object-new allocation type-to-make (the-as int (-> type-to-make size))))) + (set! (-> s4-0 engine) ((method-of-type engine new) allocation engine 'setting-control arg0 connection)) + (set! (-> s4-0 engine-hi) ((method-of-type engine new) allocation engine 'setting-control arg0 connection)) + (set! (-> s4-0 engine-pers) + ((method-of-type engine-pers new) allocation engine-pers 'setting-control arg0 connection-pers) + ) + s4-0 + ) + ) + +;; failed to figure out what this is: +0 + + + + diff --git a/test/decompiler/reference/jak3/engine/gfx/font-h_REF.gc b/test/decompiler/reference/jak3/engine/gfx/font-h_REF.gc new file mode 100644 index 0000000000..0dfe93a15a --- /dev/null +++ b/test/decompiler/reference/jak3/engine/gfx/font-h_REF.gc @@ -0,0 +1,781 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type char-verts +(deftype char-verts (structure) + ((pos vector 4 :inline) + (color vector 4 :inline) + (tex-st vector 4 :inline) + ) + ) + +;; definition for method 3 of type char-verts +(defmethod inspect ((this char-verts)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'char-verts) + (format #t "~1Tpos[4] @ #x~X~%" (-> this pos)) + (format #t "~1Tcolor[4] @ #x~X~%" (-> this color)) + (format #t "~1Ttex-st[4] @ #x~X~%" (-> this tex-st)) + (label cfg-4) + this + ) + +;; definition of type char-color +(deftype char-color (structure) + ((color rgba 4) + ) + ) + +;; definition for method 3 of type char-color +(defmethod inspect ((this char-color)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'char-color) + (format #t "~1Tcolor[4] @ #x~X~%" (-> this color)) + (label cfg-4) + this + ) + +;; definition for symbol *font-default-matrix*, type matrix +(define *font-default-matrix* (new 'static 'matrix + :rvec (new 'static 'vector :x 1.0) + :uvec (new 'static 'vector :y 1.0) + :fvec (new 'static 'vector :z 1.0) + :trans (new 'static 'vector :x -256.0 :y -208.0 :w 1.0) + ) + ) + +;; definition of type font-context +(deftype font-context (basic) + ((origin vector :inline) + (strip-gif vector :inline) + (width float) + (height float) + (projection float) + (scale float) + (color font-color) + (flags font-flags) + (mat matrix) + (start-line uint32) + (alpha float) + (max-x float) + ) + (:methods + (new (symbol type matrix int int float font-color font-flags) _type_) + (set-mat! (font-context matrix) font-context) + (set-origin! (font-context int int) font-context) + (set-depth! (font-context int) font-context) + (set-w! (font-context float) font-context) + (set-width! (font-context int) font-context) + (set-height! (font-context int) font-context) + (set-projection! (font-context float) font-context) + (set-color! (font-context font-color) font-context) + (set-flags! (font-context font-flags) font-context) + (set-start-line! (font-context uint) font-context) + (set-scale! (font-context float) font-context) + (set-alpha! (font-context float) font-context) + ) + ) + +;; definition for method 3 of type font-context +(defmethod inspect ((this font-context)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this (-> this type)) + (format #t "~1Torigin: #~%" (-> this origin)) + (format #t "~1Tstrip-gif: #~%" (-> this strip-gif)) + (format #t "~1Twidth: ~f~%" (-> this width)) + (format #t "~1Theight: ~f~%" (-> this height)) + (format #t "~1Tprojection: ~f~%" (-> this projection)) + (format #t "~1Tscale: ~f~%" (-> this scale)) + (format #t "~1Tcolor: ~D~%" (-> this color)) + (format #t "~1Tflags: ~D~%" (-> this flags)) + (format #t "~1Tmat: #~%" (-> this mat)) + (format #t "~1Tstart-line: ~D~%" (-> this start-line)) + (format #t "~1Talpha: ~f~%" (-> this alpha)) + (format #t "~1Tmax-x: ~f~%" (-> this max-x)) + (label cfg-4) + this + ) + +;; definition for method 9 of type font-context +(defmethod set-mat! ((this font-context) (arg0 matrix)) + (set! (-> this mat) arg0) + this + ) + +;; definition for method 10 of type font-context +(defmethod set-origin! ((this font-context) (arg0 int) (arg1 int)) + (set! (-> this origin x) (the float arg0)) + (set! (-> this origin y) (the float arg1)) + this + ) + +;; definition for method 11 of type font-context +(defmethod set-depth! ((this font-context) (arg0 int)) + (set! (-> this origin z) (the float arg0)) + this + ) + +;; definition for method 12 of type font-context +(defmethod set-w! ((this font-context) (arg0 float)) + (set! (-> this origin w) arg0) + this + ) + +;; definition for method 13 of type font-context +(defmethod set-width! ((this font-context) (arg0 int)) + (set! (-> this width) (the float arg0)) + this + ) + +;; definition for method 14 of type font-context +(defmethod set-height! ((this font-context) (arg0 int)) + (set! (-> this height) (the float arg0)) + this + ) + +;; definition for method 15 of type font-context +(defmethod set-projection! ((this font-context) (arg0 float)) + (set! (-> this projection) arg0) + this + ) + +;; definition for method 16 of type font-context +(defmethod set-color! ((this font-context) (arg0 font-color)) + (set! (-> this color) arg0) + this + ) + +;; definition for method 17 of type font-context +(defmethod set-flags! ((this font-context) (arg0 font-flags)) + (set! (-> this flags) arg0) + this + ) + +;; definition for method 18 of type font-context +(defmethod set-start-line! ((this font-context) (arg0 uint)) + (set! (-> this start-line) arg0) + this + ) + +;; definition for method 19 of type font-context +(defmethod set-scale! ((this font-context) (arg0 float)) + (set! (-> this scale) arg0) + this + ) + +;; definition for method 20 of type font-context +(defmethod set-alpha! ((this font-context) (arg0 float)) + (set! (-> this alpha) arg0) + this + ) + +;; definition for method 0 of type font-context +(defmethod new font-context ((allocation symbol) + (type-to-make type) + (arg0 matrix) + (arg1 int) + (arg2 int) + (arg3 float) + (arg4 font-color) + (arg5 font-flags) + ) + (let ((v0-0 (object-new allocation type-to-make (the-as int (-> type-to-make size))))) + (set! (-> v0-0 mat) arg0) + (let ((v1-3 v0-0)) + (set! (-> v1-3 origin x) (the float arg1)) + (set! (-> v1-3 origin y) (the float arg2)) + ) + (cond + ((= arg3 0.0) + (let ((v1-4 v0-0)) + (set! (-> v1-4 origin z) (-> *math-camera* isometric trans z)) + ) + ) + (else + (let ((v1-5 v0-0)) + (set! (-> v1-5 origin z) arg3) + ) + ) + ) + (let ((v1-6 v0-0)) + (set! (-> v1-6 origin w) 1.0) + ) + (let ((v1-7 v0-0)) + (set! (-> v1-7 width) (the float 512)) + ) + (let ((v1-8 v0-0)) + (set! (-> v1-8 height) (the float 416)) + ) + (let ((v1-9 v0-0)) + (set! (-> v1-9 projection) 1.0) + ) + (set! (-> v0-0 color) arg4) + (set! (-> v0-0 flags) arg5) + (let ((a0-6 v0-0)) + (set! (-> a0-6 start-line) (the-as uint 0)) + ) + (let ((v1-13 v0-0)) + (set! (-> v1-13 scale) 1.0) + ) + (let ((v1-14 v0-0)) + (set! (-> v1-14 alpha) 1.0) + ) + v0-0 + ) + ) + +;; definition of type font-work +(deftype font-work (structure) + ((font-tmpl dma-gif-packet :inline) + (char-tmpl dma-gif-packet :inline) + (tex1-tmpl uint64 2) + (small-font-0-tmpl uint64 2) + (small-font-1-tmpl uint64 2) + (small-font-2-tmpl uint64 2) + (small-font-3-tmpl uint64 2) + (large-font-0-tmpl uint64 2) + (large-font-1-tmpl uint64 2) + (large-font-2-tmpl uint64 2) + (large-font-3-tmpl uint64 2) + (size1-small vector :inline) + (size2-small vector :inline) + (size3-small vector :inline) + (size1-large vector :inline) + (size2-large-0 vector :inline) + (size2-large-1 vector :inline) + (size2-large-2 vector :inline) + (size2-large-3 vector :inline) + (size3-large vector :inline) + (size2-0 vector :inline) + (size2-1 vector :inline) + (size2-2 vector :inline) + (size2-3 vector :inline) + (size-st1 vector :inline) + (size-st2 vector :inline) + (size-st3 vector :inline) + (save vector :inline) + (save-color vector 4 :inline) + (character-save-color vector 4 :inline) + (current-verts char-verts :inline) + (src-verts char-verts :inline) + (dest-verts char-verts :inline) + (justify vector 64 :inline) + (color-shadow vector4w :inline) + (color-table char-color 45 :inline) + (current-font-0-tmpl uint64 2) + (current-font-1-tmpl uint64 2) + (current-font-2-tmpl uint64 2) + (current-font-3-tmpl uint64 2) + (last-color font-color) + (save-last-color font-color) + (character-save-last-color uint32) + (buf basic) + (str-ptr uint32) + (flags font-flags) + (reg-save uint32 5) + ) + (:methods + (font-work-method-9 () none) + ) + ) + +;; definition for method 3 of type font-work +(defmethod inspect ((this font-work)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'font-work) + (format #t "~1Tfont-tmpl: #~%" (-> this font-tmpl)) + (format #t "~1Tchar-tmpl: #~%" (-> this char-tmpl)) + (format #t "~1Ttex1-tmpl[2] @ #x~X~%" (-> this tex1-tmpl)) + (format #t "~1Tsmall-font-0-tmpl[2] @ #x~X~%" (-> this small-font-0-tmpl)) + (format #t "~1Tsmall-font-1-tmpl[2] @ #x~X~%" (-> this small-font-1-tmpl)) + (format #t "~1Tsmall-font-2-tmpl[2] @ #x~X~%" (-> this small-font-2-tmpl)) + (format #t "~1Tsmall-font-3-tmpl[2] @ #x~X~%" (-> this small-font-3-tmpl)) + (format #t "~1Tlarge-font-0-tmpl[2] @ #x~X~%" (-> this large-font-0-tmpl)) + (format #t "~1Tlarge-font-1-tmpl[2] @ #x~X~%" (-> this large-font-1-tmpl)) + (format #t "~1Tlarge-font-2-tmpl[2] @ #x~X~%" (-> this large-font-2-tmpl)) + (format #t "~1Tlarge-font-3-tmpl[2] @ #x~X~%" (-> this large-font-3-tmpl)) + (format #t "~1Tsize1-small: #~%" (-> this size1-small)) + (format #t "~1Tsize2-small: #~%" (-> this size2-small)) + (format #t "~1Tsize3-small: #~%" (-> this size3-small)) + (format #t "~1Tsize1-large: #~%" (-> this size1-large)) + (format #t "~1Tsize2-large-0: #~%" (-> this size2-large-0)) + (format #t "~1Tsize2-large-1: #~%" (-> this size2-large-1)) + (format #t "~1Tsize2-large-2: #~%" (-> this size2-large-2)) + (format #t "~1Tsize2-large-3: #~%" (-> this size2-large-3)) + (format #t "~1Tsize3-large: #~%" (-> this size3-large)) + (format #t "~1Tsize2-0: #~%" (-> this size2-0)) + (format #t "~1Tsize2-1: #~%" (-> this size2-1)) + (format #t "~1Tsize2-2: #~%" (-> this size2-2)) + (format #t "~1Tsize2-3: #~%" (-> this size2-3)) + (format #t "~1Tsize-st1: #~%" (-> this size-st1)) + (format #t "~1Tsize-st2: #~%" (-> this size-st2)) + (format #t "~1Tsize-st3: #~%" (-> this size-st3)) + (format #t "~1Tsave: #~%" (-> this save)) + (format #t "~1Tsave-color[4] @ #x~X~%" (-> this save-color)) + (format #t "~1Tcharacter-save-color[4] @ #x~X~%" (-> this character-save-color)) + (format #t "~1Tcurrent-verts: #~%" (-> this current-verts)) + (format #t "~1Tsrc-verts: #~%" (-> this src-verts)) + (format #t "~1Tdest-verts: #~%" (-> this dest-verts)) + (format #t "~1Tjustify[64] @ #x~X~%" (-> this justify)) + (format #t "~1Tcolor-shadow: #~%" (-> this color-shadow)) + (format #t "~1Tcolor-table[45] @ #x~X~%" (-> this color-table)) + (format #t "~1Tcurrent-font-0-tmpl[2] @ #x~X~%" (-> this current-font-0-tmpl)) + (format #t "~1Tcurrent-font-1-tmpl[2] @ #x~X~%" (-> this current-font-1-tmpl)) + (format #t "~1Tcurrent-font-2-tmpl[2] @ #x~X~%" (-> this current-font-2-tmpl)) + (format #t "~1Tcurrent-font-3-tmpl[2] @ #x~X~%" (-> this current-font-3-tmpl)) + (format #t "~1Tlast-color: ~D~%" (-> this last-color)) + (format #t "~1Tsave-last-color: ~D~%" (-> this save-last-color)) + (format #t "~1Tcharacter-save-last-color: ~D~%" (-> this character-save-last-color)) + (format #t "~1Tbuf: ~A~%" (-> this buf)) + (format #t "~1Tstr-ptr: ~D~%" (-> this str-ptr)) + (format #t "~1Tflags: ~D~%" (-> this flags)) + (format #t "~1Treg-save[5] @ #x~X~%" (-> this reg-save)) + (label cfg-4) + this + ) + +;; definition for symbol *font-work*, type font-work +(define *font-work* + (new 'static 'font-work + :font-tmpl (new 'static 'dma-gif-packet + :dma-vif (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x2 :id (dma-tag-id cnt)) + :vif1 (new 'static 'vif-tag :imm #x2 :cmd (vif-cmd direct) :msk #x1) + ) + :gif (new 'static 'array uint64 2 #x102e400000008001 #xe) + ) + :char-tmpl (new 'static 'dma-gif-packet + :dma-vif (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #xe :id (dma-tag-id cnt)) + :vif1 (new 'static 'vif-tag :imm #xe :cmd (vif-cmd direct) :msk #x1) + ) + :gif (new 'static 'array uint64 2 #xd02e400000008001 #x412412412412e) + ) + :tex1-tmpl (new 'static 'array uint64 2 #x60 #x14) + :small-font-0-tmpl (new 'static 'array uint64 2 #x0 #x6) + :small-font-1-tmpl (new 'static 'array uint64 2 #x0 #x6) + :small-font-2-tmpl (new 'static 'array uint64 2 #x0 #x6) + :small-font-3-tmpl (new 'static 'array uint64 2 #x0 #x6) + :large-font-0-tmpl (new 'static 'array uint64 2 #x0 #x6) + :large-font-1-tmpl (new 'static 'array uint64 2 #x0 #x6) + :large-font-2-tmpl (new 'static 'array uint64 2 #x0 #x6) + :large-font-3-tmpl (new 'static 'array uint64 2 #x0 #x6) + :size1-small (new 'static 'vector :x 12.0 :w 0.5) + :size2-small (new 'static 'vector :y 14.857 :w 8.0) + :size3-small (new 'static 'vector :x 12.0 :y 14.857 :w 14.857) + :size1-large (new 'static 'vector :x 24.0 :w 1.0) + :size2-large-0 (new 'static 'vector :y 29.714 :w 24.0) + :size2-large-1 (new 'static 'vector :y 29.714 :w 24.0) + :size2-large-2 (new 'static 'vector :y 29.714 :w 24.0) + :size2-large-3 (new 'static 'vector :y 29.714 :w 24.0) + :size3-large (new 'static 'vector :x 24.0 :y 29.714 :w 29.714) + :size-st1 (new 'static 'vector :x 0.08985 :w 0.5) + :size-st2 (new 'static 'vector :y 0.031007752 :w 0.5) + :size-st3 (new 'static 'vector :x 0.08985 :y 0.031007752 :w 0.5) + :current-verts (new 'static 'char-verts + :pos (new 'static 'inline-array vector 4 + (new 'static 'vector :w 1.0) + (new 'static 'vector :w 1.0) + (new 'static 'vector :w 1.0) + (new 'static 'vector :w 1.0) + ) + :tex-st (new 'static 'inline-array vector 4 + (new 'static 'vector :z 1.0) + (new 'static 'vector :z 1.0) + (new 'static 'vector :z 1.0) + (new 'static 'vector :z 1.0) + ) + ) + :src-verts (new 'static 'char-verts + :pos (new 'static 'inline-array vector 4 + (new 'static 'vector :w 1.0) + (new 'static 'vector :w 1.0) + (new 'static 'vector :w 1.0) + (new 'static 'vector :w 1.0) + ) + :tex-st (new 'static 'inline-array vector 4 + (new 'static 'vector :z 1.0) + (new 'static 'vector :z 1.0) + (new 'static 'vector :z 1.0) + (new 'static 'vector :z 1.0) + ) + ) + :dest-verts (new 'static 'char-verts + :pos (new 'static 'inline-array vector 4 + (new 'static 'vector :w 1.0) + (new 'static 'vector :w 1.0) + (new 'static 'vector :w 1.0) + (new 'static 'vector :w 1.0) + ) + :tex-st (new 'static 'inline-array vector 4 + (new 'static 'vector :z 1.0) + (new 'static 'vector :z 1.0) + (new 'static 'vector :z 1.0) + (new 'static 'vector :z 1.0) + ) + ) + :color-shadow (new 'static 'vector4w :w #x80) + :color-table (new 'static 'inline-array char-color 45 + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :r #x70 :g #x78 :b #x70 :a #x80) + (new 'static 'rgba :r #x70 :g #x78 :b #x70 :a #x80) + (new 'static 'rgba :r #x70 :g #x78 :b #x70 :a #x80) + (new 'static 'rgba :r #x70 :g #x78 :b #x70 :a #x80) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x80) + (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x80) + (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x80) + (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x80) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x40) + (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x40) + (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x40) + (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x40) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :r #x80 :g #x20 :a #x80) + (new 'static 'rgba :r #x80 :g #x20 :a #x80) + (new 'static 'rgba :r #x80 :g #x20 :a #x80) + (new 'static 'rgba :r #x80 :g #x20 :a #x80) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :r #x80 :g #x64 :a #x80) + (new 'static 'rgba :r #x80 :g #x64 :a #x80) + (new 'static 'rgba :r #x80 :g #x64 :a #x80) + (new 'static 'rgba :r #x80 :g #x64 :a #x80) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :r #x80 :g #x80 :a #x80) + (new 'static 'rgba :r #x80 :g #x80 :a #x80) + (new 'static 'rgba :r #x80 :g #x80 :a #x80) + (new 'static 'rgba :r #x80 :g #x80 :a #x80) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :r #x20 :g #x80 :b #x20 :a #x80) + (new 'static 'rgba :r #x20 :g #x80 :b #x20 :a #x80) + (new 'static 'rgba :r #x20 :g #x80 :b #x20 :a #x80) + (new 'static 'rgba :r #x20 :g #x80 :b #x20 :a #x80) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :g #x20 :b #x80 :a #x80) + (new 'static 'rgba :g #x20 :b #x80 :a #x80) + (new 'static 'rgba :g #x20 :b #x80 :a #x80) + (new 'static 'rgba :g #x20 :b #x80 :a #x80) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :g #x80 :b #x80 :a #x80) + (new 'static 'rgba :g #x80 :b #x80 :a #x80) + (new 'static 'rgba :g #x80 :b #x80 :a #x80) + (new 'static 'rgba :g #x80 :b #x80 :a #x80) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :r #x80 :g #x40 :b #x80 :a #x80) + (new 'static 'rgba :r #x80 :g #x40 :b #x80 :a #x80) + (new 'static 'rgba :r #x80 :g #x40 :b #x80 :a #x80) + (new 'static 'rgba :r #x80 :g #x40 :b #x80 :a #x80) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :r #x60 :g #x80 :b #x80 :a #x80) + (new 'static 'rgba :r #x60 :g #x80 :b #x80 :a #x80) + (new 'static 'rgba :r #x60 :g #x80 :b #x80 :a #x80) + (new 'static 'rgba :r #x60 :g #x80 :b #x80 :a #x80) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :r #x40 :g #x60 :b #x60 :a #x80) + (new 'static 'rgba :r #x40 :g #x60 :b #x60 :a #x80) + (new 'static 'rgba :r #x40 :g #x60 :b #x60 :a #x80) + (new 'static 'rgba :r #x40 :g #x60 :b #x60 :a #x80) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x80) + (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x80) + (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x80) + (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x80) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :r #x50 :g #x50 :b #x50 :a #x80) + (new 'static 'rgba :r #x50 :g #x50 :b #x50 :a #x80) + (new 'static 'rgba :r #x50 :g #x50 :b #x50 :a #x80) + (new 'static 'rgba :r #x50 :g #x50 :b #x50 :a #x80) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :r #x80 :g #x54 :a #x80) + (new 'static 'rgba :r #x80 :g #x54 :a #x80) + (new 'static 'rgba :r #x80 :g #x54 :a #x80) + (new 'static 'rgba :r #x80 :g #x54 :a #x80) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :r #x70 :g #x80 :b #x30 :a #x80) + (new 'static 'rgba :r #x70 :g #x80 :b #x30 :a #x80) + (new 'static 'rgba :r #x70 :g #x80 :b #x30 :a #x80) + (new 'static 'rgba :r #x70 :g #x80 :b #x30 :a #x80) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :r #x48 :g #x58 :b #x10 :a #x80) + (new 'static 'rgba :r #x48 :g #x58 :b #x10 :a #x80) + (new 'static 'rgba :r #x48 :g #x58 :b #x10 :a #x80) + (new 'static 'rgba :r #x48 :g #x58 :b #x10 :a #x80) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :r #x58 :g #x60 :b #x58 :a #x80) + (new 'static 'rgba :r #x58 :g #x60 :b #x58 :a #x80) + (new 'static 'rgba :r #x58 :g #x60 :b #x58 :a #x80) + (new 'static 'rgba :r #x58 :g #x60 :b #x58 :a #x80) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :r #x40 :g #x48 :b #x40 :a #x80) + (new 'static 'rgba :r #x40 :g #x48 :b #x40 :a #x80) + (new 'static 'rgba :r #x40 :g #x48 :b #x40 :a #x80) + (new 'static 'rgba :r #x40 :g #x48 :b #x40 :a #x80) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :r #x30 :g #x20 :b #x30 :a #x80) + (new 'static 'rgba :r #x30 :g #x20 :b #x30 :a #x80) + (new 'static 'rgba :r #x30 :g #x20 :b #x30 :a #x80) + (new 'static 'rgba :r #x30 :g #x20 :b #x30 :a #x80) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :r #x80 :g #x79 :b #x48 :a #x80) + (new 'static 'rgba :r #x80 :g #x79 :b #x48 :a #x80) + (new 'static 'rgba :r #x80 :g #x79 :b #x48 :a #x80) + (new 'static 'rgba :r #x80 :g #x79 :b #x48 :a #x80) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :r #x20 :g #x5e :b #x78 :a #x80) + (new 'static 'rgba :r #x20 :g #x5e :b #x78 :a #x80) + (new 'static 'rgba :r #x20 :g #x5e :b #x78 :a #x80) + (new 'static 'rgba :r #x20 :g #x5e :b #x78 :a #x80) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :r #x1d :g #x1d :b #x1d :a #x80) + (new 'static 'rgba :r #x1d :g #x1d :b #x1d :a #x80) + (new 'static 'rgba :r #x1d :g #x1d :b #x1d :a #x80) + (new 'static 'rgba :r #x1d :g #x1d :b #x1d :a #x80) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :r #x40 :g #x40 :b #x40 :a #x80) + (new 'static 'rgba :r #x40 :g #x40 :b #x40 :a #x80) + (new 'static 'rgba :r #x40 :g #x40 :b #x40 :a #x80) + (new 'static 'rgba :r #x40 :g #x40 :b #x40 :a #x80) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :r #x7a :g #x4d :b #x65 :a #x80) + (new 'static 'rgba :r #x7a :g #x4d :b #x65 :a #x80) + (new 'static 'rgba :r #x7a :g #x4d :b #x65 :a #x80) + (new 'static 'rgba :r #x7a :g #x4d :b #x65 :a #x80) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :r #x7a :g #x34 :b #x34 :a #x80) + (new 'static 'rgba :r #x7a :g #x34 :b #x34 :a #x80) + (new 'static 'rgba :r #x7a :g #x34 :b #x34 :a #x80) + (new 'static 'rgba :r #x7a :g #x34 :b #x34 :a #x80) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :r #x10 :g #x65 :b #x4c :a #x80) + (new 'static 'rgba :r #x10 :g #x65 :b #x4c :a #x80) + (new 'static 'rgba :r #x10 :g #x65 :b #x4c :a #x80) + (new 'static 'rgba :r #x10 :g #x65 :b #x4c :a #x80) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :r #x46 :g #x4a :b #x78 :a #x80) + (new 'static 'rgba :r #x46 :g #x4a :b #x78 :a #x80) + (new 'static 'rgba :r #x46 :g #x4a :b #x78 :a #x80) + (new 'static 'rgba :r #x46 :g #x4a :b #x78 :a #x80) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :r #x57 :g #x7e :b #x80 :a #x80) + (new 'static 'rgba :r #x57 :g #x7e :b #x80 :a #x80) + (new 'static 'rgba :r #x57 :g #x7e :b #x80 :a #x80) + (new 'static 'rgba :r #x57 :g #x7e :b #x80 :a #x80) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :r #x7f :g #x7b :b #x33 :a #x80) + (new 'static 'rgba :r #x7f :g #x7b :b #x33 :a #x80) + (new 'static 'rgba :r #x7f :g #x7b :b #x33 :a #x80) + (new 'static 'rgba :r #x7f :g #x7b :b #x33 :a #x80) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :r #x79 :g #x79 :b #x2 :a #x80) + (new 'static 'rgba :r #x79 :g #x79 :b #x2 :a #x80) + (new 'static 'rgba :r #x79 :g #x79 :b #x2 :a #x80) + (new 'static 'rgba :r #x79 :g #x79 :b #x2 :a #x80) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :r #x47 :g #x68 :b #x7a :a #x80) + (new 'static 'rgba :r #x47 :g #x68 :b #x7a :a #x80) + (new 'static 'rgba :r #x47 :g #x68 :b #x7a :a #x80) + (new 'static 'rgba :r #x47 :g #x68 :b #x7a :a #x80) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :r #xb7 :g #x80 :b #x7 :a #x80) + (new 'static 'rgba :r #xb7 :g #x80 :b #x7 :a #x80) + (new 'static 'rgba :r #xb7 :g #x80 :b #x7 :a #x80) + (new 'static 'rgba :r #xb7 :g #x80 :b #x7 :a #x80) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :r #x80 :g #x80 :b #x40 :a #x80) + (new 'static 'rgba :r #x80 :g #x80 :b #x40 :a #x80) + (new 'static 'rgba :r #x80 :g #x80 :b #x40 :a #x80) + (new 'static 'rgba :r #x80 :g #x80 :b #x40 :a #x80) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x80) + (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x80) + (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x80) + (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x80) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :r #x9a :g #x4d :a #x60) + (new 'static 'rgba :r #x9a :g #x4d :a #x60) + (new 'static 'rgba :r #x9a :g #x4d :a #x60) + (new 'static 'rgba :r #x9a :g #x4d :a #x60) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :r #x70 :g #x78 :b #x70 :a #x80) + (new 'static 'rgba :r #x70 :g #x78 :b #x70 :a #x80) + (new 'static 'rgba :r #x70 :g #x78 :b #x70 :a #x80) + (new 'static 'rgba :r #x70 :g #x78 :b #x70 :a #x80) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :r #x60 :a #x80) + (new 'static 'rgba :r #x60 :a #x80) + (new 'static 'rgba :r #x60 :a #x80) + (new 'static 'rgba :r #x60 :a #x80) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :r #x80 :g #x60 :b #x20 :a #x80) + (new 'static 'rgba :r #x80 :g #x60 :b #x20 :a #x80) + (new 'static 'rgba :r #x80 :g #x60 :b #x20 :a #x80) + (new 'static 'rgba :r #x80 :g #x60 :b #x20 :a #x80) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :b #x1 :a #x80) + (new 'static 'rgba :b #x1 :a #x80) + (new 'static 'rgba :b #x1 :a #x80) + (new 'static 'rgba :b #x1 :a #x80) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :r #x48 :g #x74 :b #x48 :a #x80) + (new 'static 'rgba :r #x48 :g #x74 :b #x48 :a #x80) + (new 'static 'rgba :r #x48 :g #x74 :b #x48 :a #x80) + (new 'static 'rgba :r #x48 :g #x74 :b #x48 :a #x80) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :g #x39 :b #x67 :a #x80) + (new 'static 'rgba :g #x39 :b #x67 :a #x80) + (new 'static 'rgba :g #x39 :b #x67 :a #x80) + (new 'static 'rgba :g #x39 :b #x67 :a #x80) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :r #x7c :a #x80) + (new 'static 'rgba :r #x7c :a #x80) + (new 'static 'rgba :r #x7c :a #x80) + (new 'static 'rgba :r #x7c :a #x80) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :r #x60 :g #x60 :b #x60 :a #x80) + (new 'static 'rgba :r #x60 :g #x60 :b #x60 :a #x80) + (new 'static 'rgba :r #x60 :g #x60 :b #x60 :a #x80) + (new 'static 'rgba :r #x60 :g #x60 :b #x60 :a #x80) + ) + ) + (new 'static 'char-color :color (new 'static 'array rgba 4 + (new 'static 'rgba :r #x40 :g #x40 :b #x40 :a #x80) + (new 'static 'rgba :r #x40 :g #x40 :b #x40 :a #x80) + (new 'static 'rgba :r #x40 :g #x40 :b #x40 :a #x80) + (new 'static 'rgba :r #x40 :g #x40 :b #x40 :a #x80) + ) + ) + ) + ) + ) + +;; definition for function font-set-tex0 +;; WARN: Return type mismatch int vs none. +(defun font-set-tex0 ((arg0 (pointer gs-tex0)) (arg1 texture) (arg2 int) (arg3 int) (arg4 int)) + (set! (-> arg0 0) (new 'static 'gs-tex0 + :tcc #x1 + :cld #x1 + :cbp arg4 + :th (+ (log2 (+ (-> arg1 h) -1)) 1) + :tw (log2 (-> arg1 w)) + :tbw (-> arg1 width 0) + :tbp0 (/ arg2 64) + :psm arg3 + ) + ) + (none) + ) + +;; definition for function set-font-color +(defun set-font-color ((arg0 font-color) (arg1 int) (arg2 rgba) (arg3 rgba) (arg4 rgba)) + (set! (-> *font-work* color-table arg0 color 0) (the-as rgba arg1)) + (set! (-> *font-work* color-table arg0 color 1) arg2) + (set! (-> *font-work* color-table arg0 color 2) arg3) + (set! (-> *font-work* color-table arg0 color 3) arg4) + 0 + ) + +;; failed to figure out what this is: +0 + + + + diff --git a/test/decompiler/reference/jak3/engine/gfx/hw/display-h_REF.gc b/test/decompiler/reference/jak3/engine/gfx/hw/display-h_REF.gc index fcb69220da..c545486ca9 100644 --- a/test/decompiler/reference/jak3/engine/gfx/hw/display-h_REF.gc +++ b/test/decompiler/reference/jak3/engine/gfx/hw/display-h_REF.gc @@ -91,7 +91,7 @@ (vu1-enable-user-menu vu1-renderer-mask) (force-sync uint32) (mem-reserve-size uint32) - (dma-buffer-overflow basic) + (dma-buffer-overflow symbol) ) (:methods (new (symbol type int int int int int) _type_) diff --git a/test/decompiler/reference/jak3/engine/gfx/hw/display_REF.gc b/test/decompiler/reference/jak3/engine/gfx/hw/display_REF.gc new file mode 100644 index 0000000000..6c057b3ceb --- /dev/null +++ b/test/decompiler/reference/jak3/engine/gfx/hw/display_REF.gc @@ -0,0 +1,429 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition for function get-current-time +(defun get-current-time () + "Get the base-clock time." + (-> *display* base-clock frame-counter) + ) + +;; definition for function get-integral-current-time +(defun get-integral-current-time () + "Get the number of frames that have happened." + (-> *display* base-clock integral-frame-counter) + ) + +;; definition for function get-real-current-time +(defun get-real-current-time () + (-> *display* real-clock frame-counter) + ) + +;; definition for method 9 of type display +(defmethod set-time-ratios ((this display) (arg0 float)) + (set! (-> this dog-ratio) (fmin 4.0 arg0)) + (case (get-video-mode) + (('pal) + (set! (-> this time-factor) 6.0) + ) + (else + (set! (-> this time-factor) 5.0) + ) + ) + (-> this dog-ratio) + ) + +;; definition for function set-display +(defun set-display ((arg0 display)) + "Allocate and initialize clocks for the display." + (dotimes (s5-0 22) + (set! (-> arg0 clock s5-0) (new 'global 'clock s5-0)) + ) + (set! (-> arg0 base-clock mask) (process-mask freeze pause menu progress)) + (set! (-> arg0 game-clock mask) (process-mask freeze pause menu progress movie)) + (set! (-> arg0 total-game-clock mask) (process-mask freeze pause menu progress)) + (set! (-> arg0 frame-clock mask) (process-mask freeze pause menu progress)) + (set! (-> arg0 target-clock mask) (process-mask freeze pause menu progress)) + (set! (-> arg0 camera-clock mask) (process-mask freeze pause menu progress)) + (set! (-> arg0 entity-clock mask) (process-mask freeze pause menu progress)) + (set! (-> arg0 part-clock mask) (process-mask freeze pause menu progress)) + (set! (-> arg0 bg-clock mask) (process-mask freeze pause menu progress)) + (set! (-> arg0 user0-clock mask) (process-mask freeze pause menu progress)) + (set! (-> arg0 user1-clock mask) (process-mask freeze pause menu progress)) + (set! (-> arg0 user2-clock mask) (process-mask freeze pause menu progress)) + (set! (-> arg0 user3-clock mask) (process-mask freeze pause menu progress)) + (set! (-> arg0 user4-clock mask) (process-mask freeze pause menu progress)) + (set! (-> arg0 user5-clock mask) (process-mask freeze pause menu progress)) + (set! (-> arg0 user6-clock mask) (process-mask freeze pause menu progress)) + (set! (-> arg0 user7-clock mask) (process-mask freeze pause menu progress)) + (set! (-> arg0 user8-clock mask) (process-mask freeze pause menu progress)) + (set! (-> arg0 user9-clock mask) (process-mask freeze pause menu progress)) + (set! (-> *listener-process* clock) (-> arg0 real-clock)) + (set! (-> *active-pool* clock) (-> arg0 real-clock)) + (set! (-> *display-pool* clock) (-> arg0 real-clock)) + (set! (-> *mid-pool* clock) (-> arg0 real-clock)) + (+! (-> arg0 real-clock ref-count) 4) + (set! (-> *camera-pool* clock) (-> arg0 camera-clock)) + (+! (-> arg0 camera-clock ref-count) 1) + (set! (-> *target-pool* clock) (-> arg0 target-clock)) + (+! (-> arg0 target-clock ref-count) 1) + (set! (-> *pusher-pool* clock) (-> arg0 entity-clock)) + (set! (-> *entity-pool* clock) (-> arg0 entity-clock)) + (+! (-> arg0 entity-clock ref-count) 2) + (set! (-> *bg-pool* clock) (-> arg0 bg-clock)) + (+! (-> arg0 bg-clock ref-count) 1) + (set! (-> *default-pool* clock) (-> arg0 base-clock)) + (+! (-> arg0 base-clock ref-count) 1) + (+! (-> *kernel-clock* ref-count) -10) + arg0 + ) + +;; definition for function allocate-dma-buffers +(defun allocate-dma-buffers ((arg0 display)) + "Allocate the main, debug, and calc dma buffers." + (when (zero? (-> arg0 frames 0 calc-buf)) + (set! (-> arg0 frames 0 calc-buf) (new 'global 'dma-buffer 10000)) + (set! (-> arg0 frames 1 calc-buf) (new 'global 'dma-buffer 10000)) + (set! (-> arg0 frames 0 global-buf) (new 'global 'dma-buffer #x140000)) + (set! (-> arg0 frames 1 global-buf) (new 'global 'dma-buffer #x140000)) + (when *debug-segment* + (set! (-> arg0 frames 0 debug-buf) (new 'debug 'dma-buffer #x800000)) + (set! (-> arg0 frames 1 debug-buf) (new 'debug 'dma-buffer #x800000)) + ) + (set! (-> arg0 dma-buffer-overflow) #f) + (set! (-> arg0 mem-reserve-size) (the-as uint 0)) + 0 + ) + arg0 + ) + +;; definition for symbol *font-context*, type font-context +(define *font-context* + (new 'global 'font-context *font-default-matrix* 0 0 0.0 (font-color default) (font-flags shadow kerning)) + ) + +;; definition for function draw-sprite2d-xy +;; WARN: Return type mismatch pointer vs none. +(defun draw-sprite2d-xy ((arg0 dma-buffer) (arg1 int) (arg2 int) (arg3 int) (arg4 int) (arg5 rgba) (arg6 int)) + "Draw a sprite primitive with the given color and dimensions." + (let* ((t2-2 (new 'stack 'draw-context arg1 arg2 arg3 arg4 arg5)) + (a0-3 (max 1792 (min 2304 (+ (-> t2-2 orgx) 1792)))) + (a3-3 (max 1840 (min 2256 (+ (-> t2-2 orgy) 1840)))) + (a1-6 (-> t2-2 width)) + (t1-2 (-> t2-2 height)) + (v1-6 (-> arg0 base)) + ) + (let* ((a2-2 arg0) + (t0-2 (the-as object (-> a2-2 base))) + ) + (set! (-> (the-as dma-packet t0-2) dma) (new 'static 'dma-tag :id (dma-tag-id cnt))) + (set! (-> (the-as dma-packet t0-2) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet t0-2) vif1) (new 'static 'vif-tag :cmd (vif-cmd direct) :msk #x1)) + (set! (-> a2-2 base) (&+ (the-as pointer t0-2) 16)) + ) + (let* ((a2-3 arg0) + (t0-4 (the-as object (-> a2-3 base))) + ) + (set! (-> (the-as gs-gif-tag t0-4) tag) + (new 'static 'gif-tag64 :nloop #x1 :eop #x1 :flg (gif-flag reg-list) :nreg #x4) + ) + (set! (-> (the-as gs-gif-tag t0-4) regs) + (new 'static 'gif-tag-regs :regs1 (gif-reg-id rgbaq) :regs2 (gif-reg-id xyzf2) :regs3 (gif-reg-id xyzf2)) + ) + (set! (-> a2-3 base) (&+ (the-as pointer t0-4) 16)) + ) + (let* ((a2-4 arg0) + (t0-6 (-> a2-4 base)) + ) + (set! (-> (the-as (pointer gs-prim) t0-6) 0) (new 'static 'gs-prim :prim (gs-prim-type sprite) :abe #x1)) + (set! (-> (the-as (pointer gs-rgbaq) t0-6) 1) (the-as gs-rgbaq (-> t2-2 color 0))) + (set! (-> (the-as (pointer gs-xyzf) t0-6) 2) (new 'static 'gs-xyzf :x (* a0-3 16) :y (* a3-3 16) :z arg6)) + (set! (-> (the-as (pointer gs-xyzf) t0-6) 3) (new 'static 'gs-xyzf + :x (* (max 1792 (min 2304 (+ a0-3 a1-6))) 16) + :y (* (max 1840 (min 2256 (+ a3-3 t1-2))) 16) + :z arg6 + ) + ) + (set! (-> a2-4 base) (&+ t0-6 32)) + ) + (let ((a0-12 (/ (the-as int (+ (- -16 (the-as int v1-6)) (the-as int (-> arg0 base)))) 16))) + (cond + ((nonzero? a0-12) + (logior! (-> (the-as (pointer uint64) v1-6) 0) (shr (shl a0-12 48) 48)) + (logior! (-> (the-as (pointer uint64) v1-6) 1) (shl (shr (shl a0-12 48) 48) 32)) + ) + (else + (set! (-> arg0 base) v1-6) + ) + ) + ) + ) + (none) + ) + +;; definition for function draw-sprite2d-xy-absolute +;; WARN: Return type mismatch pointer vs none. +(defun draw-sprite2d-xy-absolute ((arg0 dma-buffer) (arg1 int) (arg2 int) (arg3 int) (arg4 int) (arg5 rgba) (arg6 int)) + "Draw a sprite primitive, setting the gs-xzyf register to exactly the values specified (no offset/clamp)." + (let ((a1-1 (+ arg1 1792)) + (a2-1 (+ arg2 1840)) + (v1-0 (-> arg0 base)) + ) + (let* ((t3-0 arg0) + (t4-0 (the-as object (-> t3-0 base))) + ) + (set! (-> (the-as dma-packet t4-0) dma) (new 'static 'dma-tag :id (dma-tag-id cnt))) + (set! (-> (the-as dma-packet t4-0) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet t4-0) vif1) (new 'static 'vif-tag :cmd (vif-cmd direct) :msk #x1)) + (set! (-> t3-0 base) (&+ (the-as pointer t4-0) 16)) + ) + (let* ((t3-1 arg0) + (t4-2 (the-as object (-> t3-1 base))) + ) + (set! (-> (the-as gs-gif-tag t4-2) tag) + (new 'static 'gif-tag64 :nloop #x1 :eop #x1 :flg (gif-flag reg-list) :nreg #x4) + ) + (set! (-> (the-as gs-gif-tag t4-2) regs) + (new 'static 'gif-tag-regs :regs1 (gif-reg-id rgbaq) :regs2 (gif-reg-id xyzf2) :regs3 (gif-reg-id xyzf2)) + ) + (set! (-> t3-1 base) (&+ (the-as pointer t4-2) 16)) + ) + (let* ((t3-2 arg0) + (t4-4 (-> t3-2 base)) + ) + (set! (-> (the-as (pointer gs-prim) t4-4) 0) (new 'static 'gs-prim :prim (gs-prim-type sprite) :abe #x1)) + (set! (-> (the-as (pointer gs-rgbaq) t4-4) 1) (the-as gs-rgbaq arg5)) + (set! (-> (the-as (pointer gs-xyzf) t4-4) 2) (new 'static 'gs-xyzf :x (* a1-1 16) :y (* a2-1 16) :z arg6)) + (set! (-> (the-as (pointer gs-xyzf) t4-4) 3) + (new 'static 'gs-xyzf :x (* (+ a1-1 arg3) 16) :y (* (+ a2-1 arg4) 16) :z arg6) + ) + (set! (-> t3-2 base) (&+ t4-4 32)) + ) + (let ((a1-10 (/ (the-as int (+ (- -16 (the-as int v1-0)) (the-as int (-> arg0 base)))) 16))) + (cond + ((nonzero? a1-10) + (set! (-> (the-as (pointer uint64) v1-0) 0) + (logior (-> (the-as (pointer uint64) v1-0)) (shr (shl a1-10 48) 48)) + ) + (logior! (-> (the-as (pointer uint64) v1-0) 1) (shl (shr (shl a1-10 48) 48) 32)) + ) + (else + (set! (-> arg0 base) v1-0) + ) + ) + ) + ) + (none) + ) + +;; definition for function draw-quad2d +;; WARN: Return type mismatch pointer vs none. +(defun draw-quad2d ((arg0 dma-buffer) (arg1 draw-context)) + "Draw a quad that fills the entire context." + (let ((a3-1 (max 1792 (min 2304 (+ (-> arg1 orgx) 1792)))) + (a2-3 (max 1840 (min 2256 (+ (-> arg1 orgy) 1840)))) + (t3-0 (-> arg1 width)) + (t0-2 (-> arg1 height)) + (v1-4 (-> arg0 base)) + ) + (let* ((t1-0 arg0) + (t2-0 (the-as object (-> t1-0 base))) + ) + (set! (-> (the-as dma-packet t2-0) dma) (new 'static 'dma-tag :id (dma-tag-id cnt))) + (set! (-> (the-as dma-packet t2-0) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet t2-0) vif1) (new 'static 'vif-tag :cmd (vif-cmd direct) :msk #x1)) + (set! (-> t1-0 base) (&+ (the-as pointer t2-0) 16)) + ) + (let* ((t1-1 arg0) + (t2-2 (the-as object (-> t1-1 base))) + ) + (set! (-> (the-as gs-gif-tag t2-2) tag) + (new 'static 'gif-tag64 :nloop #x1 :eop #x1 :flg (gif-flag reg-list) :nreg #x9) + ) + (set! (-> (the-as gs-gif-tag t2-2) regs) (new 'static 'gif-tag-regs + :regs1 (gif-reg-id rgbaq) + :regs2 (gif-reg-id xyzf2) + :regs3 (gif-reg-id rgbaq) + :regs4 (gif-reg-id xyzf2) + :regs5 (gif-reg-id rgbaq) + :regs6 (gif-reg-id xyzf2) + :regs7 (gif-reg-id rgbaq) + :regs8 (gif-reg-id xyzf2) + ) + ) + (set! (-> t1-1 base) (&+ (the-as pointer t2-2) 16)) + ) + (let* ((t1-2 arg0) + (t2-4 (-> t1-2 base)) + ) + (set! (-> (the-as (pointer gs-prim) t2-4) 0) + (new 'static 'gs-prim :prim (gs-prim-type tri-strip) :iip #x1 :abe #x1) + ) + (set! (-> (the-as (pointer gs-rgbaq) t2-4) 1) (the-as gs-rgbaq (-> arg1 color 0))) + (set! (-> (the-as (pointer gs-xyzf) t2-4) 2) (new 'static 'gs-xyzf :y (* a2-3 16) :x (* a3-1 16))) + (set! (-> (the-as (pointer gs-rgbaq) t2-4) 3) (the-as gs-rgbaq (-> arg1 color 1))) + (set! (-> (the-as (pointer gs-xyzf) t2-4) 4) + (new 'static 'gs-xyzf :y (* a2-3 16) :x (* (max 1792 (min 2304 (+ a3-1 t3-0))) 16)) + ) + (set! (-> (the-as (pointer gs-rgbaq) t2-4) 5) (the-as gs-rgbaq (-> arg1 color 2))) + (set! (-> (the-as (pointer gs-xyzf) t2-4) 6) + (new 'static 'gs-xyzf :y (* (max 1840 (min 2256 (+ a2-3 t0-2))) 16) :x (* a3-1 16)) + ) + (set! (-> (the-as (pointer gs-rgbaq) t2-4) 7) (the-as gs-rgbaq (-> arg1 color 3))) + (set! (-> (the-as (pointer gs-xyzf) t2-4) 8) (new 'static 'gs-xyzf + :y (* (max 1840 (min 2256 (+ a2-3 t0-2))) 16) + :x (* (max 1792 (min 2304 (+ a3-1 t3-0))) 16) + ) + ) + (set! (-> (the-as (pointer uint64) t2-4) 9) (the-as uint 0)) + (set! (-> t1-2 base) (&+ t2-4 80)) + ) + (let ((a1-11 (/ (the-as int (+ (- -16 (the-as int v1-4)) (the-as int (-> arg0 base)))) 16))) + (cond + ((nonzero? a1-11) + (set! (-> (the-as (pointer uint64) v1-4) 0) + (logior (-> (the-as (pointer uint64) v1-4)) (shr (shl a1-11 48) 48)) + ) + (logior! (-> (the-as (pointer uint64) v1-4) 1) (shl (shr (shl a1-11 48) 48) 32)) + ) + (else + (set! (-> arg0 base) v1-4) + ) + ) + ) + ) + (none) + ) + +;; definition for function screen-gradient +(defun screen-gradient ((arg0 dma-buffer) (arg1 rgba) (arg2 rgba) (arg3 rgba) (arg4 rgba)) + "Fill the screen with a sprite with the given colors." + (let ((a1-2 (new 'stack 'draw-context 0 0 512 416 (new 'static 'rgba)))) + (set! (-> a1-2 color 0) arg1) + (set! (-> a1-2 color 1) arg2) + (set! (-> a1-2 color 2) arg3) + (set! (-> a1-2 color 3) arg4) + (draw-quad2d arg0 a1-2) + ) + (none) + ) + +;; definition for function vif1-handler-debug +;; ERROR: function was not converted to expressions. Cannot decompile. + +;; definition for function vif1-handler +;; ERROR: function was not converted to expressions. Cannot decompile. + +;; failed to figure out what this is: +(install-handler 5 (if *debug-segment* + vif1-handler-debug + vif1-handler + ) + ) + +;; definition for function vblank-handler +;; ERROR: function was not converted to expressions. Cannot decompile. + +;; definition for function set-display-gs-state +(defun set-display-gs-state ((arg0 dma-buffer) (arg1 int) (arg2 int) (arg3 int) (arg4 int) (arg5 int)) + (let ((v1-1 (/ (+ arg2 63) 64)) + (t2-0 *display*) + (t3-0 144) + ) + (+! (-> t2-0 mem-reserve-size) t3-0) + (when (not (-> t2-0 dma-buffer-overflow)) + (let ((t5-0 (-> t2-0 frames (-> t2-0 on-screen) global-buf))) + (if (< (-> t5-0 real-buffer-end) (the-as int (&+ (-> t5-0 base) t3-0))) + (set! (-> t2-0 dma-buffer-overflow) #t) + ) + ) + (if (not (-> t2-0 dma-buffer-overflow)) + (dma-buffer-add-gs-set-flusha arg0 + (scissor-1 (new 'static 'gs-scissor :scax1 (+ arg2 -1) :scay1 (+ arg3 -1))) + (xyoffset-1 (new 'static 'gs-xy-offset)) + (frame-1 (new 'static 'gs-frame :fbp arg1 :fbw v1-1 :psm arg5 :fbmsk arg4)) + (test-1 (new 'static 'gs-test :zte #x1 :ztst (gs-ztest always))) + (texa (new 'static 'gs-texa :ta0 #x80 :ta1 #x80)) + (zbuf-1 (new 'static 'gs-zbuf :zbp #x130 :psm (gs-psm ct24) :zmsk #x1)) + (texflush 0) + ) + ) + ) + ) + arg0 + ) + +;; definition for function set-display-gs-state-offset +(defun set-display-gs-state-offset ((arg0 dma-buffer) (arg1 int) (arg2 int) (arg3 int) (arg4 int) (arg5 int) (arg6 int) (arg7 int)) + (let ((v1-1 (/ (+ arg2 63) 64)) + (t4-0 *display*) + (t5-0 144) + ) + (+! (-> t4-0 mem-reserve-size) t5-0) + (when (not (-> t4-0 dma-buffer-overflow)) + (let ((t7-0 (-> t4-0 frames (-> t4-0 on-screen) global-buf))) + (if (< (-> t7-0 real-buffer-end) (the-as int (&+ (-> t7-0 base) t5-0))) + (set! (-> t4-0 dma-buffer-overflow) #t) + ) + ) + (if (not (-> t4-0 dma-buffer-overflow)) + (dma-buffer-add-gs-set-flusha arg0 + (scissor-1 (new 'static 'gs-scissor :scax1 (+ arg2 -1) :scay1 (+ arg3 -1))) + (xyoffset-1 (new 'static 'gs-xy-offset :ofx (* arg6 16) :ofy (* arg7 16))) + (frame-1 (new 'static 'gs-frame :fbp arg1 :fbw v1-1 :psm arg5 :fbmsk arg4)) + (test-1 (new 'static 'gs-test :zte #x1 :ztst (gs-ztest always))) + (texa (new 'static 'gs-texa :ta0 #x80 :ta1 #x80)) + (zbuf-1 (new 'static 'gs-zbuf :zbp #x130 :psm (gs-psm ct24) :zmsk #x1)) + (texflush 0) + ) + ) + ) + ) + arg0 + ) + +;; definition for function reset-display-gs-state +(defun reset-display-gs-state ((arg0 display) (arg1 dma-buffer)) + (let ((v1-0 *display*) + (a2-0 144) + ) + (+! (-> v1-0 mem-reserve-size) a2-0) + (when (not (-> v1-0 dma-buffer-overflow)) + (let ((t0-0 (-> v1-0 frames (-> v1-0 on-screen) global-buf))) + (if (< (-> t0-0 real-buffer-end) (the-as int (&+ (-> t0-0 base) a2-0))) + (set! (-> v1-0 dma-buffer-overflow) #t) + ) + ) + (if (not (-> v1-0 dma-buffer-overflow)) + (dma-buffer-add-gs-set-flusha arg1 + (scissor-1 (new 'static 'gs-scissor :scax1 #x1ff :scay1 #x19f)) + (xyoffset-1 (new 'static 'gs-xy-offset :ofx #x7000 :ofy #x7300)) + (frame-1 (new 'static 'gs-frame :fbp #x198 :fbw #x8)) + (test-1 (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal))) + (texa (new 'static 'gs-texa :ta1 #x80)) + (zbuf-1 (new 'static 'gs-zbuf :zbp #x130 :psm (gs-psm ct24))) + (texflush 0) + ) + ) + ) + ) + arg0 + ) + +;; failed to figure out what this is: +(kmemopen global "dma-buffers") + +;; definition for symbol *vu0-dma-list*, type dma-buffer +(define *vu0-dma-list* (new 'global 'dma-buffer 4096)) + +;; definition for symbol *display*, type display +(define *display* (new 'global 'display 0 512 416 2 49)) + +;; failed to figure out what this is: +(allocate-dma-buffers *display*) + +;; failed to figure out what this is: +(kmemclose) + + + + diff --git a/test/decompiler/reference/jak3/engine/ui/text-h_REF.gc b/test/decompiler/reference/jak3/engine/ui/text-h_REF.gc new file mode 100644 index 0000000000..75ff1d53a6 --- /dev/null +++ b/test/decompiler/reference/jak3/engine/ui/text-h_REF.gc @@ -0,0 +1,65 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type game-text +(deftype game-text (structure) + ((id text-id) + (text string) + ) + ) + +;; definition for method 3 of type game-text +(defmethod inspect ((this game-text)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'game-text) + (format #t "~1Tid: ~D~%" (-> this id)) + (format #t "~1Ttext: ~A~%" (-> this text)) + (label cfg-4) + this + ) + +;; definition of type game-text-info +(deftype game-text-info (basic) + ((length int32) + (language-id int32) + (group-name string) + (data game-text :dynamic) + ) + (:methods + (lookup-text! (_type_ text-id symbol) string) + ) + ) + +;; definition for method 3 of type game-text-info +(defmethod inspect ((this game-text-info)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this (-> this type)) + (format #t "~1Tlength: ~D~%" (-> this length)) + (format #t "~1Tlanguage-id: ~D~%" (-> this language-id)) + (format #t "~1Tgroup-name: ~A~%" (-> this group-name)) + (format #t "~1Tdata[0] @ #x~X~%" (-> this data)) + (label cfg-4) + this + ) + +;; definition for symbol *text-group-names*, type (array string) +(define *text-group-names* (new 'static 'boxed-array :type string "common")) + +;; definition for symbol *common-text-heap*, type kheap +(define *common-text-heap* (new 'global 'kheap)) + +;; definition for symbol *common-text*, type game-text-info +(define *common-text* (the-as game-text-info #f)) + +;; failed to figure out what this is: +0 + + + + diff --git a/test/decompiler/reference/jak3/engine/util/profile-h_REF.gc b/test/decompiler/reference/jak3/engine/util/profile-h_REF.gc index 780be35e21..d231143304 100644 --- a/test/decompiler/reference/jak3/engine/util/profile-h_REF.gc +++ b/test/decompiler/reference/jak3/engine/util/profile-h_REF.gc @@ -126,7 +126,7 @@ ;; definition of type profile-spec (deftype profile-spec (structure) "Specification for a profile category." - ((name basic) + ((name symbol) (color rgba) ) ) diff --git a/test/decompiler/reference/jak3/engine/util/profile_REF.gc b/test/decompiler/reference/jak3/engine/util/profile_REF.gc new file mode 100644 index 0000000000..d672325997 --- /dev/null +++ b/test/decompiler/reference/jak3/engine/util/profile_REF.gc @@ -0,0 +1,1032 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition for symbol *profile-spec-array*, type (inline-array profile-spec) +(define *profile-spec-array* + (new 'static 'inline-array profile-spec 14 + (new 'static 'profile-spec :name 'dummy :color (new 'static 'rgba :r #x20 :g #x20 :b #x20 :a #x80)) + (new 'static 'profile-spec :name 'blit-displays :color (new 'static 'rgba :r #x20 :g #x20 :b #x80 :a #x80)) + (new 'static 'profile-spec :name 'sky :color (new 'static 'rgba :r #x20 :g #x80 :b #x20 :a #x80)) + (new 'static 'profile-spec :name 'ocean :color (new 'static 'rgba :r #x20 :g #x80 :b #x80 :a #x80)) + (new 'static 'profile-spec :name 'hfrag :color (new 'static 'rgba :r #x80 :g #x20 :b #x20 :a #x80)) + (new 'static 'profile-spec :name 'tfrag :color (new 'static 'rgba :r #x80 :g #x20 :b #x80 :a #x80)) + (new 'static 'profile-spec :name 'texture :color (new 'static 'rgba :r #x80 :g #x80 :b #x20 :a #x80)) + (new 'static 'profile-spec :name 'tie :color (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x80)) + (new 'static 'profile-spec :name 'generic :color (new 'static 'rgba :r #xc0 :g #xc0 :a #x80)) + (new 'static 'profile-spec :name 'merc :color (new 'static 'rgba :r #xc0 :b #xc0 :a #x80)) + (new 'static 'profile-spec :name 'shrubbery :color (new 'static 'rgba :r #xc0 :a #x80)) + (new 'static 'profile-spec :name 'particle :color (new 'static 'rgba :g #xc0 :b #xc0 :a #x80)) + (new 'static 'profile-spec :name 'debug :color (new 'static 'rgba :g #xc0 :a #x80)) + (new 'static 'profile-spec :name 'other :color (new 'static 'rgba :r #xc0 :g #xc0 :b #xc0 :a #x80)) + ) + ) + +;; definition for symbol *profile-translate-array*, type (pointer uint64) +(define *profile-translate-array* (new 'static 'array uint64 584 + #x0 + #x0 + #x0 + #x1 + #x6 + #x2 + #x3 + #x6 + #x4 + #x4 + #x6 + #x5 + #x7 + #x7 + #x5 + #x7 + #x7 + #x9 + #x9 + #x8 + #x7 + #x8 + #x6 + #x5 + #x7 + #x7 + #x5 + #x7 + #x7 + #x9 + #x9 + #x8 + #x7 + #x8 + #x6 + #x5 + #x7 + #x7 + #x5 + #x7 + #x7 + #x9 + #x9 + #x8 + #x7 + #x8 + #x6 + #x5 + #x7 + #x7 + #x5 + #x7 + #x7 + #x9 + #x9 + #x8 + #x7 + #x8 + #x6 + #x5 + #x7 + #x7 + #x5 + #x7 + #x7 + #x9 + #x9 + #x8 + #x7 + #x8 + #x6 + #x5 + #x7 + #x7 + #x5 + #x7 + #x7 + #x9 + #x9 + #x8 + #x7 + #x8 + #x6 + #x5 + #x7 + #x7 + #x5 + #x7 + #x7 + #x9 + #x9 + #x8 + #x7 + #x8 + #x6 + #x5 + #x7 + #x7 + #x5 + #x7 + #x7 + #x9 + #x9 + #x8 + #x7 + #x8 + #x6 + #x5 + #x7 + #x7 + #x5 + #x7 + #x7 + #x9 + #x9 + #x8 + #x7 + #x8 + #x6 + #x5 + #x7 + #x7 + #x5 + #x7 + #x7 + #x9 + #x9 + #x8 + #x7 + #x8 + #x6 + #xa + #x8 + #xa + #xa + #x8 + #x9 + #x9 + #x8 + #x8 + #x6 + #xa + #x8 + #xa + #xa + #x8 + #x9 + #x9 + #x8 + #x8 + #x6 + #xa + #x8 + #xa + #xa + #x8 + #x9 + #x9 + #x8 + #x8 + #x6 + #xa + #x8 + #xa + #xa + #x8 + #x9 + #x9 + #x8 + #x8 + #x6 + #xa + #x8 + #xa + #xa + #x8 + #x9 + #x9 + #x8 + #x8 + #x6 + #xa + #x8 + #xa + #xa + #x8 + #x9 + #x9 + #x8 + #x8 + #x6 + #xa + #x8 + #xa + #xa + #x8 + #x9 + #x9 + #x8 + #x8 + #x6 + #xa + #x8 + #xa + #xa + #x8 + #x9 + #x9 + #x8 + #x8 + #x6 + #xa + #x8 + #xa + #xa + #x8 + #x9 + #x9 + #x8 + #x8 + #x6 + #xa + #x8 + #xa + #xa + #x8 + #x9 + #x9 + #x8 + #x8 + #x6 + #x5 + #x7 + #x7 + #x9 + #x9 + #x8 + #x5 + #x7 + #x7 + #x8 + #x6 + #x5 + #x7 + #x7 + #x9 + #x9 + #x8 + #x5 + #x7 + #x7 + #x8 + #x6 + #x5 + #x7 + #x7 + #x9 + #x9 + #x8 + #x5 + #x7 + #x7 + #x8 + #x6 + #x5 + #x7 + #x7 + #x9 + #x9 + #x8 + #x5 + #x7 + #x7 + #x8 + #x6 + #x5 + #x7 + #x7 + #x9 + #x9 + #x8 + #x5 + #x7 + #x7 + #x8 + #x6 + #x5 + #x7 + #x7 + #x9 + #x9 + #x8 + #x5 + #x7 + #x7 + #x8 + #x6 + #x5 + #x7 + #x7 + #x9 + #x9 + #x8 + #x5 + #x7 + #x7 + #x8 + #x6 + #x5 + #x7 + #x7 + #x9 + #x9 + #x8 + #x5 + #x7 + #x7 + #x8 + #x6 + #x5 + #x7 + #x7 + #x9 + #x9 + #x8 + #x5 + #x7 + #x7 + #x8 + #x6 + #x5 + #x7 + #x7 + #x9 + #x9 + #x8 + #x5 + #x7 + #x7 + #x8 + #x6 + #x9 + #x9 + #x8 + #x8 + #x6 + #x9 + #x9 + #x8 + #x8 + #xd + #x6 + #x9 + #x9 + #x8 + #x8 + #x6 + #x9 + #x9 + #x8 + #x8 + #x6 + #x9 + #x9 + #x8 + #x8 + #x6 + #x9 + #x9 + #x8 + #x8 + #x6 + #x9 + #x9 + #x8 + #x8 + #x6 + #x9 + #x9 + #x8 + #x8 + #x6 + #x9 + #x9 + #x8 + #x8 + #x6 + #x9 + #x9 + #x8 + #x8 + #x6 + #x9 + #x9 + #x8 + #x8 + #x6 + #x9 + #x9 + #x8 + #x8 + #x6 + #x9 + #x9 + #x8 + #x8 + #x6 + #x9 + #x9 + #x8 + #x8 + #x6 + #x9 + #x9 + #x8 + #x8 + #x6 + #x9 + #x9 + #x8 + #x8 + #x6 + #x9 + #x9 + #x8 + #x8 + #x6 + #x9 + #x9 + #x8 + #x8 + #x6 + #x9 + #x9 + #x8 + #x8 + #x6 + #x9 + #x9 + #x8 + #x8 + #x6 + #x9 + #x9 + #x8 + #x8 + #x6 + #x9 + #x9 + #x8 + #x8 + #x6 + #x9 + #x9 + #x8 + #x8 + #x6 + #x9 + #x9 + #x8 + #x8 + #x6 + #x3 + #x6 + #x9 + #x8 + #x5 + #x7 + #x7 + #x7 + #x5 + #x7 + #x8 + #x6 + #x9 + #x8 + #x5 + #x7 + #x7 + #x7 + #x5 + #x7 + #x8 + #x6 + #x9 + #x8 + #x5 + #x7 + #x7 + #x7 + #x5 + #x7 + #x8 + #x6 + #x9 + #x8 + #x5 + #x7 + #x7 + #x7 + #x5 + #x7 + #x8 + #x6 + #x9 + #x8 + #x5 + #x7 + #x7 + #x7 + #x5 + #x7 + #x8 + #x6 + #x9 + #x8 + #x5 + #x7 + #x7 + #x7 + #x5 + #x7 + #x8 + #x6 + #x9 + #x8 + #x5 + #x7 + #x7 + #x7 + #x5 + #x7 + #x8 + #x6 + #x9 + #x8 + #x5 + #x7 + #x7 + #x7 + #x5 + #x7 + #x8 + #x6 + #x9 + #x8 + #x5 + #x7 + #x7 + #x7 + #x5 + #x7 + #x8 + #x6 + #x9 + #x8 + #x5 + #x7 + #x7 + #x7 + #x5 + #x7 + #x8 + #x6 + #x9 + #x8 + #x8 + #x1 + #x6 + #x8 + #xb + #xd + #xd + #x6 + #x9 + #xc + #x6 + #xd + #xd + #xd + #xd + #xc + #xc + #xc + ) + ) + +;; definition of type profile-work +(deftype profile-work (structure) + "DMA templates for profile drawing." + ((sprite-tmpl dma-gif-packet :inline) + (line-tmpl dma-gif-packet :inline) + (last-index int32) + ) + ) + +;; definition for method 3 of type profile-work +(defmethod inspect ((this profile-work)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'profile-work) + (format #t "~1Tsprite-tmpl: #~%" (-> this sprite-tmpl)) + (format #t "~1Tline-tmpl: #~%" (-> this line-tmpl)) + (format #t "~1Tlast-index: ~D~%" (-> this last-index)) + (label cfg-4) + this + ) + +;; definition for symbol *profile-work*, type profile-work +(define *profile-work* (new 'static 'profile-work + :sprite-tmpl (new 'static 'dma-gif-packet + :dma-vif (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x4 :id (dma-tag-id cnt)) + :vif1 (new 'static 'vif-tag :imm #x4 :cmd (vif-cmd direct) :msk #x1) + ) + :gif (new 'static 'array uint64 2 #x3023400000008001 #x551) + ) + :line-tmpl (new 'static 'dma-gif-packet + :dma-vif (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x4 :id (dma-tag-id cnt)) + :vif1 (new 'static 'vif-tag :imm #x4 :cmd (vif-cmd direct) :msk #x1) + ) + :gif (new 'static 'array uint64 2 #x3020c00000008001 #x551) + ) + ) + ) + +;; definition for symbol *profile-x*, type int +(define *profile-x* 1808) + +;; definition for symbol *profile-y*, type int +(define *profile-y* 1848) + +;; definition for symbol *profile-w*, type int +(define *profile-w* 416) + +;; definition for symbol *profile-h*, type int +(define *profile-h* 8) + +;; definition for symbol *profile-ticks*, type symbol +(define *profile-ticks* #f) + +;; definition for method 10 of type profile-segment-array +;; WARN: Return type mismatch int vs none. +(defmethod start-frame! ((this profile-segment-array)) + "Restart the profiler for the start of a frame." + (set! (-> this count) 0) + (set! (-> this depth) 0) + (set! (-> this max-depth) 0) + (set! (-> this base-time) (the-as int (timer-count (the-as timer-bank #x10000800)))) + (start-segment! this 'all *profile-all-color*) + 0 + (none) + ) + +;; definition for method 11 of type profile-segment-array +;; WARN: Return type mismatch int vs none. +(defmethod start-segment! ((this profile-segment-array) (arg0 symbol) (arg1 rgba)) + "Start an event." + (when (and *dproc* *debug-segment*) + (let ((s4-0 (-> this data (-> this count)))) + (let ((s3-0 (-> this base-time))) + (set! (-> s4-0 name) arg0) + (set! (-> s4-0 start-time) (the-as int (- (timer-count (the-as timer-bank #x10000800)) (the-as uint s3-0)))) + ) + (set! (-> s4-0 depth) (the-as uint (-> this depth))) + (set! (-> s4-0 color) arg1) + (set! (-> this segment (-> this depth)) s4-0) + ) + (set! (-> this count) (min 1023 (+ (-> this count) 1))) + (+! (-> this depth) 1) + (set! (-> this max-depth) (max (-> this max-depth) (-> this depth))) + ) + 0 + (none) + ) + +;; definition for method 12 of type profile-segment-array +;; WARN: Return type mismatch int vs none. +(defmethod end-segment! ((this profile-segment-array)) + "Stop the most recently started event." + (when (and *dproc* *debug-segment*) + (let* ((v1-4 (+ (-> this depth) -1)) + (s5-0 (-> this segment v1-4)) + (s4-0 (-> this base-time)) + ) + (when (>= v1-4 0) + (set! (-> s5-0 end-time) (the-as int (- (timer-count (the-as timer-bank #x10000800)) (the-as uint s4-0)))) + (+! (-> this depth) -1) + ) + ) + ) + 0 + (none) + ) + +;; definition for method 9 of type profile-array +;; WARN: Return type mismatch int vs none. +(defmethod postprocess-data! ((this profile-array)) + "Create the collapsed summary of the collected data." + (dotimes (s5-0 2) + (let ((s3-0 (-> *profile-array* data s5-0)) + (s4-0 *profile-collapse*) + ) + (mem-copy! (&-> s3-0 type) (&-> (-> this data s5-0) type) #x4030) + (cond + ((zero? s5-0) + ((lambda ((arg0 profile-segment-array) (arg1 profile-collapse)) + (let ((v0-0 0)) + (dotimes (v1-0 48) + (set! (-> arg1 data v1-0 name) #f) + (set! (-> arg1 data v1-0 count) (the-as uint 0)) + (set! (-> arg1 data v1-0 vu-count) (the-as uint 0)) + (set! (-> arg1 data v1-0 depth) (the-as uint 0)) + (set! (-> arg1 data v1-0 start-time) 0) + (set! (-> arg1 data v1-0 end-time) 0) + ) + (dotimes (v1-3 (-> arg0 count)) + (let ((a2-15 (- (-> arg0 data v1-3 end-time) (-> arg0 data v1-3 start-time)))) + (let ((t0-0 (-> arg0 data v1-3 name))) + (dotimes (a3-5 v0-0) + (when (= (-> arg1 data a3-5 name) t0-0) + (+! (-> arg1 data a3-5 count) 1) + (set! (-> arg1 data a3-5 start-time) (the-as int (+ (-> arg1 data a3-5 code-time) a2-15))) + (goto cfg-11) + ) + ) + (set! (-> arg1 data v0-0 name) t0-0) + ) + (set! (-> arg1 data v0-0 count) (the-as uint 1)) + (set! (-> arg1 data v0-0 depth) (-> arg0 data v1-3 depth)) + (set! (-> arg1 data v0-0 start-time) a2-15) + ) + (set! (-> arg1 data v0-0 color) (-> arg0 data v1-3 color)) + (set! v0-0 (min 47 (+ v0-0 1))) + (label cfg-11) + ) + (set! (-> arg1 count) v0-0) + ) + (none) + ) + s3-0 + s4-0 + ) + ) + (else + (let ((v1-6 3) + (a0-5 (+ (-> s3-0 count) -1)) + ) + (while (>= a0-5 v1-6) + (let ((a1-4 (-> s3-0 data v1-6))) + (set! (-> a1-4 name) (-> *profile-spec-array* (-> *profile-translate-array* v1-6) name)) + (set! (-> a1-4 color) (-> *profile-spec-array* (-> *profile-translate-array* v1-6) color)) + (let ((a2-14 (- (-> a1-4 end-time) (-> a1-4 start-time))) + (a3-5 (-> a1-4 name)) + ) + (dotimes (a1-5 (-> s4-0 count)) + (when (= (-> s4-0 data a1-5 name) a3-5) + (+! (-> s4-0 data a1-5 vu-count) 1) + (set! (-> s4-0 data a1-5 end-time) (the-as int (+ (-> s4-0 data a1-5 vu-time) a2-14))) + (goto cfg-11) + ) + ) + ) + ) + (label cfg-11) + (+! v1-6 1) + ) + ) + (countdown (v1-9 (-> s3-0 count)) + (when (nonzero? (-> s3-0 data v1-9 end-time)) + (set! (-> s4-0 data 0 vu-count) (the-as uint 1)) + (set! (-> s4-0 data 0 end-time) (- (-> s3-0 data v1-9 end-time) (-> s3-0 data 0 start-time))) + (goto cfg-19) + ) + ) + ) + ) + ) + (label cfg-19) + ) + 0 + (none) + ) + +;; definition for method 10 of type profile-array +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod draw-bars! ((this profile-array) (arg0 dma-buffer) (arg1 int)) + "Generate DMA data for drawing the profile bars." + (local-vars (sv-16 (function _varargs_ object)) (sv-32 (function _varargs_ object))) + (dma-buffer-add-gs-set arg0 + (alpha-1 (new 'static 'gs-alpha :b #x1 :d #x1)) + (zbuf-1 (new 'static 'gs-zbuf :zbp #x130 :psm (gs-psm ct24) :zmsk #x1)) + (test-1 (new 'static 'gs-test :zte #x1 :ztst (gs-ztest always))) + (pabe 0) + (clamp-1 (new 'static 'gs-clamp :wms (gs-tex-wrap-mode clamp) :wmt (gs-tex-wrap-mode clamp))) + (tex1-1 (new 'static 'gs-tex1 :mmag #x1 :mmin #x1)) + (texa (new 'static 'gs-texa :ta1 #x80)) + (texclut (new 'static 'gs-texclut :cbw #x4)) + (fogcol *fog-color*) + ) + (let ((v1-5 (* (+ *profile-x* (/ *profile-w* 2)) 16)) + (a0-9 (-> arg0 base)) + ) + (set! (-> (the-as (pointer uint128) a0-9) 0) (-> *profile-work* line-tmpl dma-vif quad)) + (set! (-> (the-as (pointer uint128) a0-9) 1) (-> *profile-work* line-tmpl quad 1)) + (set-vector! (the-as vector4w (&+ a0-9 32)) 64 64 64 64) + (set-vector! (the-as vector4w (&+ a0-9 48)) v1-5 #x7340 #xffffff 0) + (set-vector! (the-as vector4w (&+ a0-9 64)) v1-5 #x7580 #xffffff 0) + ) + (&+! (-> arg0 base) 80) + (dotimes (s3-0 2) + (let* ((v1-12 (-> this data s3-0)) + (a0-11 (-> v1-12 max-depth)) + (s2-1 (max 14 (* a0-11 2))) + ) + (set! *profile-y* (+ arg1 1840)) + (let ((a1-32 (-> arg0 base))) + (set! (-> (the-as (pointer uint128) a1-32) 0) (-> *profile-work* sprite-tmpl dma-vif quad)) + (set! (-> (the-as (pointer uint128) a1-32) 1) (-> *profile-work* sprite-tmpl quad 1)) + (set-vector! (the-as vector4w (&+ a1-32 32)) 64 64 64 64) + (set-vector! (the-as vector4w (&+ a1-32 48)) (* *profile-x* 16) (* *profile-y* 16) #xffffff 0) + (set-vector! + (the-as vector4w (&+ a1-32 64)) + (* (+ *profile-x* *profile-w*) 16) + (* (+ *profile-y* s2-1) 16) + #xffffff + 0 + ) + ) + (&+! (-> arg0 base) 80) + (let ((a0-12 (/ s2-1 a0-11))) + (dotimes (a1-36 (-> v1-12 count)) + (let ((a2-22 (-> v1-12 data a1-36))) + (when (< (-> a2-22 start-time) (-> a2-22 end-time)) + (let* ((t0-1 (* *ticks-per-frame* 2)) + (a3-15 (* (+ *profile-x* (/ (* (-> a2-22 start-time) *profile-w*) t0-1)) 16)) + (t0-4 (* (+ *profile-x* (/ (* (-> a2-22 end-time) *profile-w*) t0-1)) 16)) + (t3-1 (* (+ arg1 1840 (* (-> a2-22 depth) (the-as uint a0-12))) 16)) + (t1-7 (+ t3-1 (* a0-12 16))) + (t2-5 (-> arg0 base)) + ) + (set! (-> (the-as (pointer int128) t2-5) 0) (the-as int128 (-> *profile-work* sprite-tmpl dma-vif quad))) + (set! (-> (the-as (pointer int128) t2-5) 1) (the-as int128 (-> *profile-work* sprite-tmpl quad 1))) + (set-vector! + (the-as vector4w (&+ t2-5 32)) + (the int (* 1.9921875 (the float (-> a2-22 color r)))) + (the int (* 1.9921875 (the float (-> a2-22 color g)))) + (the int (* 1.9921875 (the float (-> a2-22 color b)))) + (the-as int (-> a2-22 color a)) + ) + (set-vector! (the-as vector4w (&+ t2-5 48)) a3-15 t3-1 #xffffff 0) + (set-vector! (the-as vector4w (&+ t2-5 64)) t0-4 t1-7 #xffffff 0) + ) + (&+! (-> arg0 base) 80) + ) + ) + ) + ) + (cond + ((zero? s3-0) + (let* ((s1-0 (-> v1-12 data 0 end-time)) + (f30-0 (* 100.0 (/ (the float s1-0) (the float *ticks-per-frame*)))) + ) + (cond + (*profile-ticks* + (let ((s0-0 draw-string-xy)) + (set! sv-16 format) + (let ((a0-16 (clear *temp-string*)) + (a1-37 "~5D") + ) + (sv-16 a0-16 a1-37 s1-0) + ) + (s0-0 + *temp-string* + arg0 + 488 + arg1 + (if (>= f30-0 100.0) + (font-color red) + (font-color default) + ) + (font-flags shadow right) + ) + ) + ) + (else + (let ((s1-1 draw-string-xy)) + (format (clear *temp-string*) "~5,,2f" f30-0) + (s1-1 + *temp-string* + arg0 + 488 + arg1 + (if (>= f30-0 100.0) + (font-color red) + (font-color default) + ) + (font-flags shadow right) + ) + ) + ) + ) + ) + ) + (else + (let ((s1-2 0)) + (countdown (a0-21 (-> v1-12 count)) + (when (nonzero? (-> v1-12 data a0-21 end-time)) + (set! s1-2 (- (-> v1-12 data a0-21 end-time) (-> v1-12 data 0 start-time))) + (goto cfg-23) + ) + ) + (label cfg-23) + (let ((f30-1 (* 100.0 (/ (the float s1-2) (the float *ticks-per-frame*))))) + (cond + (*profile-ticks* + (let ((s0-2 draw-string-xy)) + (set! sv-32 format) + (let ((a0-26 (clear *temp-string*)) + (a1-45 "~5D") + ) + (sv-32 a0-26 a1-45 s1-2) + ) + (s0-2 + *temp-string* + arg0 + 488 + arg1 + (if (>= f30-1 100.0) + (font-color red) + (font-color default) + ) + (font-flags shadow right) + ) + ) + ) + (else + (let ((s1-3 draw-string-xy)) + (format (clear *temp-string*) "~5,,2f" f30-1) + (s1-3 + *temp-string* + arg0 + 488 + arg1 + (if (>= f30-1 100.0) + (font-color red) + (font-color default) + ) + (font-flags shadow right) + ) + ) + ) + ) + ) + ) + ) + ) + (set! arg1 (+ s2-1 2 arg1)) + ) + ) + (none) + ) + +;; definition for method 11 of type profile-array +;; WARN: Return type mismatch int vs none. +(defmethod draw-text! ((this profile-array)) + "Generate DMA data for drawing the profile information screen." + (let ((gp-0 *profile-collapse*)) + (dotimes (s5-0 (-> gp-0 count)) + (when (or (nonzero? (-> gp-0 data s5-0 count)) (nonzero? (-> gp-0 data s5-0 vu-count))) + (dotimes (s4-0 (the-as int (-> gp-0 data s5-0 depth))) + (format *stdcon* " ") + ) + (format *stdcon* "~o~s~0k" (-> gp-0 data s5-0 color) (symbol->string (-> gp-0 data s5-0 name))) + (if (nonzero? (-> gp-0 data s5-0 count)) + (format + *stdcon* + "~170h~5d~220h~5d~280h~5,,2f" + (-> gp-0 data s5-0 count) + (-> gp-0 data s5-0 code-time) + (* 100.0 (/ (the float (-> gp-0 data s5-0 code-time)) (the float *ticks-per-frame*))) + ) + ) + (if (nonzero? (-> gp-0 data s5-0 vu-count)) + (format + *stdcon* + "~338h~5d~388h~5d~448h~5,,2f" + (-> gp-0 data s5-0 vu-count) + (-> gp-0 data s5-0 vu-time) + (* 100.0 (/ (the float (-> gp-0 data s5-0 vu-time)) (the float *ticks-per-frame*))) + ) + ) + (format *stdcon* "~1k~%") + ) + ) + ) + 0 + (none) + ) + + + +