diff --git a/.vs/launch.vs.json b/.vs/launch.vs.json index 1d49cd5b83..0650cbff3b 100644 --- a/.vs/launch.vs.json +++ b/.vs/launch.vs.json @@ -21,6 +21,13 @@ "name" : "Tests - Draft Tests - Verbose", "args" : ["--gtest_brief=0", "--gtest_filter=\"*Draft*\""] }, + { + "type" : "default", + "project" : "CMakeLists.txt", + "projectTarget" : "goalc-test.exe (bin\\goalc-test.exe)", + "name" : "Tests - TypeConsistency - Verbose", + "args" : ["--gtest_brief=0", "--gtest_filter=\"*TypeConsistency*\""] + }, { "type" : "default", "project" : "CMakeLists.txt", diff --git a/Taskfile.yml b/Taskfile.yml index c5f719a9b9..0deed05a77 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -35,7 +35,7 @@ tasks: - python ./scripts/cleanup-all-types.py analyze-ee-memory: cmds: - - ./out/build/Debug/bin/memory_dump_tool.exe "{{.FILE}}" ./ > ee-analysis.log + - ./out/build/Release/bin/memory_dump_tool.exe "{{.FILE}}" ./ > ee-analysis.log watch-pcsx2: cmds: - watchmedo shell-command --drop --patterns="*.p2s" --recursive --command='task analyze-ee-memory FILE="${watch_src_path}"' "{{.SAVESTATE_DIR}}" @@ -51,6 +51,7 @@ tasks: - task: offline-tests update-reference-tests: cmds: + - cmd: python ./scripts/default-file-or-folder.py --path failures - cmd: ./out/build/Release/bin/offline-test.exe "./iso_data/jak1" --dump-mode ignore_error: true - python ./scripts/update_decomp_reference.py ./failures ./test/decompiler/reference/ diff --git a/decompiler/config/all-types.gc b/decompiler/config/all-types.gc index 7f22f04be4..7cab1bf422 100644 --- a/decompiler/config/all-types.gc +++ b/decompiler/config/all-types.gc @@ -4607,7 +4607,7 @@ ) (deftype shader-ptr (uint32) - ((shader uint32 :offset 8 :size 24)) + ((shader uint32 :offset 8 :size 24)) ;; TODO this seems wrong - default-menu::all-texture-tweak-adjust :method-count-assert 9 :size-assert #x4 :flag-assert #x900000004 @@ -4828,7 +4828,7 @@ (mem-usage-block basic :offset-assert 2496) (mem-usage int32 :offset-assert 2500) (code-memory-start pointer :offset-assert 2504) - (code-memory-end pointer :offset-assert 2508) + (code-memory-end pointer :offset-assert 2508) ;; NOTE - usually a texture-page (texture-mask uint32 9 :offset-assert 2512) (force-inside? symbol :offset-assert 2548) (pad uint8 56) @@ -4872,7 +4872,7 @@ (receiving-level basic :offset-assert 32) (load-commands pair :offset-assert 36) (play? symbol :offset-assert 40) - ;; there's something? from 40 -> 96. + ;; there's something? from 40 -> 96. ;; - Look at default-menu::debug-create-cam-restore (_hack-pad uint8 :offset 90) (level0 level :inline :offset-assert 96) (level1 level :inline :offset-assert 2704) @@ -5556,7 +5556,7 @@ (define-extern texture-page-common-boot-allocate (function texture-pool texture-page kheap int texture-page)) (define-extern texture-page-level-allocate (function texture-pool texture-page kheap int texture-page)) (define-extern relocate-later (function symbol)) -(define-extern adgif-shader-update! function) +(define-extern adgif-shader-update! (function int texture none)) ;; todo - unconfirmed (define-extern adgif-shader-login (function adgif-shader none)) (define-extern adgif-shader-login-no-remap (function adgif-shader none)) (define-extern adgif-shader-login-fast function) @@ -5616,7 +5616,8 @@ (define-extern *draw-hook* (function none)) (define-extern *debug-hook* (function none)) -(define-extern *menu-hook* (function none)) +(declare-type debug-menu-context basic) +(define-extern *menu-hook* (function debug-menu-context)) (define-extern *progress-hook* (function none)) (define-extern *dma-timeout-hook* (function none)) @@ -5802,6 +5803,7 @@ (deftype drawable (basic) ((id int16 :offset-assert 4) + ; (unknown basic :offset-assert 8) ;; - from default-menu::build-instance-list (bsphere vector :inline :offset-assert 16) ) :method-count-assert 18 @@ -6012,7 +6014,7 @@ ;; inherited inspect of process (:methods (dummy-14 () none 14) - (dummy-15 () none 15) + (dummy-15 (_type_) symbol 15) ) ) @@ -6068,7 +6070,7 @@ ) (deftype task-hint-control-group (structure) - ((tasks basic :offset-assert 0) + ((tasks (array task-hint-control) :offset-assert 0) ) :method-count-assert 9 :size-assert #x4 @@ -8805,7 +8807,7 @@ (text-ids-seen bit-array :offset-assert 112) (level-opened uint8 32 :offset-assert 116) (hint-control (array level-hint-control) :offset-assert 148) - (task-hint-control array :offset-assert 152) + (task-hint-control (array task-hint-control-group) :offset-assert 152) (total-deaths int32 :offset-assert 156) (continue-deaths int32 :offset-assert 160) (fuel-cell-deaths int32 :offset-assert 164) @@ -9013,7 +9015,8 @@ (deftype instance (drawable) ((bucket-index uint16 :offset 6) - (origin matrix4h :inline :offset-assert 32) + (unknown uint32 :offset 8) ; TODO - from default-menu + (origin matrix4h :inline :offset-assert 32) ; TODO - this can also be a float, default-menu::lambda_62 (wind-index uint16 :offset 62) ) :method-count-assert 18 @@ -10917,6 +10920,7 @@ (deftype control-info (collide-shape-moving) ( + (some-quaternion quaternion :offset 496) (unknown-vector00 vector :inline :offset 576) (unknown-surface surface :offset 660) (unknown-symbol symbol :offset 664) @@ -15053,7 +15057,7 @@ (define-extern internal-draw-debug-text-3d (function bucket-id string vector rgba vector2h pointer)) (define-extern get-debug-line (function debug-line)) (define-extern internal-draw-debug-line (function bucket-id vector vector rgba symbol rgba object)) -(define-extern draw-string (function string dma-buffer int)) +(define-extern draw-string (function string dma-buffer font-context int)) (define-extern transform-float-point (function vector vector vector)) (define-extern add-debug-point (function symbol bucket-id vector symbol)) ;; unused (define-extern add-debug-outline-triangle (function symbol bucket-id vector vector vector rgba symbol)) @@ -15656,8 +15660,8 @@ ;; - Functions -(define-extern get-string-length function) -(define-extern draw-string-adv function) +(define-extern get-string-length (function string font-context float)) +(define-extern draw-string-adv (function string dma-buffer font-context none)) ;; TODO - ret value unconfirmed! ;; - Unknowns @@ -16340,9 +16344,6 @@ (define-extern *kernel-boot-message* symbol) (define-extern *level-load-list* pair) - -;; - Unknowns - (define-extern *spawn-actors* symbol) (define-extern *default-continue* continue-point) @@ -16488,7 +16489,7 @@ ;; - Functions -(define-extern auto-save-command function) +(define-extern auto-save-command (function symbol int int process-tree none)) ;; TODO - not confirmed (define-extern auto-save-init-by-other function) (define-extern progress-allowed? (function symbol)) (define-extern print-game-text (function string font-context symbol int int float)) ; TODO decomp error, this seems correct though @@ -16955,7 +16956,7 @@ (define-extern update-sky-tng-data function) (define-extern time-of-day-update function) (define-extern start-time-of-day (function int)) -(define-extern time-of-day-setup function) +(define-extern time-of-day-setup (function symbol int none)) ;; not confirmed (define-extern set-time-of-day function) (define-extern init-time-of-day-context function) (define-extern update-time-of-day function) @@ -17757,9 +17758,12 @@ (define-extern target-cam-pos function) (define-extern cam-master-init function) +;; - Symbols + +(define-extern cam-free-floating state) + ;; - Unknowns -;;(define-extern cam-free-floating object) ;; unknown type ;;(define-extern cam-master-active object) ;; unknown type ;;(define-extern list-keeper-active object) ;; unknown type ;;(define-extern cam-fixed object) ;; unknown type @@ -18349,7 +18353,7 @@ (define-extern cam-debug-add-coll-tri function) (define-extern debug-euler function) (define-extern bike-cam-limit function) -(define-extern external-cam-reset! function) +(define-extern external-cam-reset! (function none)) ;; TODO - unconfirmed ;; - Unknowns @@ -18440,15 +18444,15 @@ ;; - Functions -(define-extern find-hint-control-index function) -(define-extern start-hint-timer function) -(define-extern increment-success-for-hint function) -(define-extern can-hint-be-played? function) -(define-extern update-task-hints function) +(define-extern find-hint-control-index (function level-hint-control int)) +(define-extern start-hint-timer (function level-hint-control none)) +(define-extern increment-success-for-hint (function level-hint-control none)) +(define-extern can-hint-be-played? (function int symbol)) +(define-extern update-task-hints (function none)) -;; - Unknowns +;; - Symbols -;;(define-extern *hint-semaphore* object) ;; unknown type +(define-extern *hint-semaphore* (pointer process-tree)) ;; likely a level-hint process ;; ---------------------- @@ -18475,7 +18479,7 @@ (define-extern level-hint-init-by-other function) (define-extern voicebox-spawn function) (define-extern hide-bottom-hud function) -(define-extern ambient-hint-init-by-other function) +(define-extern ambient-hint-init-by-other (function none)) (define-extern level-hint-process-cmd function) (define-extern task-known? (function game-task symbol)) (define-extern can-grab-display? function) @@ -19158,178 +19162,167 @@ ;; - Types -; (deftype debug-menu-context (basic) -; ((is-active basic :offset-assert 4) -; (sel-length int32 :offset-assert 8) -; (sel-menu UNKNOWN 8 :offset-assert 12) -; (root-menu basic :offset-assert 44) -; (joypad-func basic :offset-assert 48) -; (joypad-item basic :offset-assert 52) -; (font basic :offset-assert 56) -; (is-hidden basic :offset-assert 60) -; ) -; :method-count-assert 9 -; :size-assert #x40 -; :flag-assert #x900000040 -; ) +(declare-type debug-menu basic) +(deftype debug-menu-context (basic) + ((is-active symbol :offset-assert 4) + (sel-length int32 :offset-assert 8) + (sel-menu debug-menu 8 :offset-assert 12) + (root-menu debug-menu :offset-assert 44) + (joypad-func (function basic none) :offset-assert 48) + (joypad-item basic :offset-assert 52) ;; is this more specific? + (font font-context :offset-assert 56) + (is-hidden symbol :offset-assert 60) + ) + :method-count-assert 9 + :size-assert #x40 + :flag-assert #x900000040 + (:methods + (new (symbol type) _type_ 0)) + ) -; (deftype debug-menu-node (basic) -; ((name basic :offset-assert 4) -; (parent basic :offset-assert 8) -; (refresh-delay int32 :offset-assert 12) -; (refresh-ctr int32 :offset-assert 16) -; ) -; :method-count-assert 9 -; :size-assert #x14 -; :flag-assert #x900000014 -; ) +(declare-type debug-menu basic) +(deftype debug-menu-node (basic) + ((name string :offset-assert 4) + (parent debug-menu :offset-assert 8) + (refresh-delay int32 :offset-assert 12) + (refresh-ctr int32 :offset-assert 16) + ) + :method-count-assert 9 + :size-assert #x14 + :flag-assert #x900000014 + ) -; (deftype debug-menu (debug-menu-node) -; ((name basic :offset-assert 4) -; (parent basic :offset-assert 8) -; (refresh-delay int32 :offset-assert 12) -; (refresh-ctr int32 :offset-assert 16) -; (context basic :offset-assert 20) -; (selected-item basic :offset-assert 24) -; (pix-width int32 :offset-assert 28) -; (pix-height int32 :offset-assert 32) -; (items basic :offset-assert 36) -; ) -; :method-count-assert 9 -; :size-assert #x28 -; :flag-assert #x900000028 -; ) +(declare-type debug-menu-item basic) +(deftype debug-menu (debug-menu-node) + ((context debug-menu-context :offset-assert 20) + (selected-item debug-menu-item :offset-assert 24) + (pix-width int32 :offset-assert 28) + (pix-height int32 :offset-assert 32) + (items pair :offset-assert 36) ; list of debug-menu-item + ) + :method-count-assert 9 + :size-assert #x28 + :flag-assert #x900000028 + (:methods + (new (symbol type debug-menu-context string) _type_ 0)) + ) -; (deftype debug-menu-item (debug-menu-node) -; ((name basic :offset-assert 4) -; (parent basic :offset-assert 8) -; (refresh-delay int32 :offset-assert 12) -; (refresh-ctr int32 :offset-assert 16) -; (id int32 :offset-assert 20) -; ) -; :method-count-assert 9 -; :size-assert #x18 -; :flag-assert #x900000018 -; ) +(deftype debug-menu-item (debug-menu-node) + ((id int32 :offset-assert 20) + ) + :method-count-assert 9 + :size-assert #x18 + :flag-assert #x900000018 + ) -; (deftype debug-menu-item-submenu (debug-menu-item) -; ((name basic :offset-assert 4) -; (parent basic :offset-assert 8) -; (refresh-delay int32 :offset-assert 12) -; (refresh-ctr int32 :offset-assert 16) -; (id int32 :offset-assert 20) -; (submenu basic :offset-assert 24) -; ) -; :method-count-assert 9 -; :size-assert #x1c -; :flag-assert #x90000001c -; ) +(deftype debug-menu-item-submenu (debug-menu-item) + ((submenu debug-menu :offset-assert 24) + ) + :method-count-assert 9 + :size-assert #x1c + :flag-assert #x90000001c + (:methods + (new (symbol type string debug-menu) _type_ 0)) + ) -; (deftype debug-menu-item-function (debug-menu-item) -; ((name basic :offset-assert 4) -; (parent basic :offset-assert 8) -; (refresh-delay int32 :offset-assert 12) -; (refresh-ctr int32 :offset-assert 16) -; (id int32 :offset-assert 20) -; (activate-func basic :offset-assert 24) -; (hilite-timer int8 :offset-assert 28) -; ) -; :method-count-assert 9 -; :size-assert #x1d -; :flag-assert #x90000001d -; ) +(deftype debug-menu-item-function (debug-menu-item) + ((activate-func (function int int) :offset-assert 24) ;; func is kinda a guess, might be 2 ints + (hilite-timer int8 :offset-assert 28) + ) + :method-count-assert 9 + :size-assert #x1d + :flag-assert #x90000001d + (:methods + (new (symbol type string int function) _type_ 0)) + ) -; (deftype debug-menu-item-flag (debug-menu-item) -; ((name basic :offset-assert 4) -; (parent basic :offset-assert 8) -; (refresh-delay int32 :offset-assert 12) -; (refresh-ctr int32 :offset-assert 16) -; (id int32 :offset-assert 20) -; (activate-func basic :offset-assert 24) -; (is-on basic :offset-assert 28) -; ) -; :method-count-assert 9 -; :size-assert #x20 -; :flag-assert #x900000020 -; ) +(deftype debug-menu-item-flag (debug-menu-item) + ((activate-func (function int int symbol) :offset-assert 24) ;; func is kinda a guess + (is-on symbol :offset-assert 28) + ) + :method-count-assert 9 + :size-assert #x20 + :flag-assert #x900000020 + (:methods + (new (symbol type string symbol function) _type_ 0)) + ) -; (deftype debug-menu-item-var (debug-menu-item) -; ((name basic :offset-assert 4) -; (parent basic :offset-assert 8) -; (refresh-delay int32 :offset-assert 12) -; (refresh-ctr int32 :offset-assert 16) -; (id int32 :offset-assert 20) -; (display-str basic :offset-assert 24) -; (grabbed-joypad-p basic :offset-assert 28) -; (float-p basic :offset-assert 32) -; (range-p basic :offset-assert 36) -; (show-len int32 :offset-assert 40) -; (inc-delay int32 :offset-assert 44) -; (inc-delay-ctr int32 :offset-assert 48) -; (step-delay-ctr int32 :offset-assert 52) -; (inc-dir int32 :offset-assert 56) -; (fval float :offset-assert 60) -; (fundo-val float :offset-assert 64) -; (frange-min float :offset-assert 68) -; (frange-max float :offset-assert 72) -; (fstart-inc float :offset-assert 76) -; (fstep float :offset-assert 80) -; (fprecision int32 :offset-assert 84) -; (factivate-func basic :offset-assert 88) -; (ival int32 :offset-assert 60) -; (iundo-val int32 :offset-assert 64) -; (irange-min int32 :offset-assert 68) -; (irange-max int32 :offset-assert 72) -; (istart-inc int32 :offset-assert 76) -; (istep int32 :offset-assert 80) -; (ihex-p basic :offset-assert 92) -; (iactivate-func basic :offset-assert 88) -; (ifloat-p basic :offset-assert 96) -; ) -; :method-count-assert 9 -; :size-assert #x64 -; :flag-assert #x900000064 -; ) +(deftype debug-menu-item-var (debug-menu-item) + ((display-str string :offset-assert 24) + (grabbed-joypad-p symbol :offset-assert 28) + (float-p symbol :offset-assert 32) + (range-p symbol :offset-assert 36) + (show-len int32 :offset-assert 40) + (inc-delay int32 :offset-assert 44) + (inc-delay-ctr int32 :offset-assert 48) + (step-delay-ctr int32 :offset-assert 52) + (inc-dir int32 :offset-assert 56) + (fval float :offset-assert 60) + (fundo-val float :offset-assert 64) + (frange-min float :offset-assert 68) + (frange-max float :offset-assert 72) + (fstart-inc float :offset-assert 76) + (fstep float :offset-assert 80) + (fprecision int32 :offset-assert 84) + ; (function int (the id) int (some constant) (fval or ival)x2 ) + (factivate-func function :offset-assert 88) + (ival int32 :offset 60) + (iundo-val int32 :offset 64) + (irange-min int32 :offset 68) + (irange-max int32 :offset 72) + (istart-inc int32 :offset 76) + (istep int32 :offset 80) + (ihex-p symbol :offset-assert 92) + ; (function int (the id) int (some constant) (fval or ival)x2 ) + (iactivate-func function :offset 88) + (ifloat-p symbol :offset-assert 96) + ) + :method-count-assert 9 + :size-assert #x64 + :flag-assert #x900000064 + (:methods + (new (symbol type string int int) _type_ 0)) + ) ;; - Functions -(define-extern debug-menus-active function) -(define-extern debug-menus-default-joypad-func function) -(define-extern debug-menu-context-render function) -(define-extern debug-menu-context-close-submenu function) -(define-extern debug-menu-context-activate-selection function) -(define-extern debug-menu-context-select-new-item function) -(define-extern debug-menu-item-send-msg function) -(define-extern debug-menu-send-msg function) -(define-extern debug-menu-context-send-msg function) -(define-extern debug-menu-item-submenu-msg function) -(define-extern debug-menu-item-function-msg function) -(define-extern debug-menu-item-flag-msg function) -(define-extern debug-menu-item-var-msg function) -(define-extern debug-menu-context-release-joypad function) -(define-extern debug-menu-context-grab-joypad function) -(define-extern debug-menu-item-var-joypad-handler function) -(define-extern debug-menu-item-var-update-display-str function) -(define-extern debug-menu-context-open-submenu function) -(define-extern debug-menu-context-select-next-or-prev-item function) -(define-extern debug-menu-render function) -(define-extern debug-menu-item-render function) -(define-extern debug-menu-item-submenu-render function) -(define-extern debug-menu-item-function-render function) -(define-extern debug-menu-item-flag-render function) -(define-extern debug-menu-item-var-render function) -(define-extern debug-menu-make-from-template function) -(define-extern debug-menu-append-item function) -(define-extern debug-menu-context-set-root-menu function) -(define-extern debug-menu-func-decode function) -(define-extern debug-menu-item-var-make-int function) -(define-extern debug-menu-item-var-make-float function) -(define-extern debug-menu-rebuild function) -(define-extern debug-menu-context-default-selection function) -(define-extern debug-menu-item-get-max-width function) -(define-extern debug-menu-remove-all-items function) -(define-extern debug-menu-find-from-template function) -(define-extern debug-menus-handler function) +(define-extern debug-menus-active (function debug-menu-context debug-menu-context)) +(define-extern debug-menus-default-joypad-func (function debug-menu-context debug-menu-context)) +(define-extern debug-menu-context-render (function debug-menu-context debug-menu-context)) +(define-extern debug-menu-context-close-submenu (function debug-menu-context debug-menu-context)) +(define-extern debug-menu-context-activate-selection (function debug-menu-context debug-menu-context)) +(define-extern debug-menu-context-select-new-item (function debug-menu-context int debug-menu-context)) +(define-extern debug-menu-item-send-msg (function debug-menu-item int debug-menu-item)) +(define-extern debug-menu-send-msg (function debug-menu int symbol debug-menu)) +(define-extern debug-menu-context-send-msg (function debug-menu-context int int debug-menu-context)) +(define-extern debug-menu-item-submenu-msg (function debug-menu-item-submenu int debug-menu-item-submenu)) +(define-extern debug-menu-item-function-msg (function debug-menu-item-function symbol debug-menu-item-function)) +(define-extern debug-menu-item-flag-msg (function debug-menu-item-flag int debug-menu-item-flag)) +(define-extern debug-menu-item-var-msg (function debug-menu-item-var int debug-menu-item-var)) +(define-extern debug-menu-context-release-joypad (function debug-menu-context symbol)) ;; this is called with a second arg in places, but definitely not used! +(define-extern debug-menu-context-grab-joypad (function debug-menu-context basic function symbol)) +(define-extern debug-menu-item-var-joypad-handler (function debug-menu-item-var debug-menu-item-var)) +(define-extern debug-menu-item-var-update-display-str (function debug-menu-item-var debug-menu-item-var)) +(define-extern debug-menu-context-open-submenu (function debug-menu-context debug-menu basic)) ;; can also return string error messages +(define-extern debug-menu-context-select-next-or-prev-item (function debug-menu-context int debug-menu-context)) +(define-extern debug-menu-render (function debug-menu int int int int debug-menu)) +(define-extern debug-menu-item-render (function debug-menu-item int int int symbol debug-menu-item)) +(define-extern debug-menu-item-submenu-render (function debug-menu-item-submenu int int int symbol debug-menu-item-submenu)) +(define-extern debug-menu-item-function-render (function debug-menu-item-function int int int symbol debug-menu-item-function)) +(define-extern debug-menu-item-flag-render (function debug-menu-item-flag int int int symbol debug-menu-item-flag)) +(define-extern debug-menu-item-var-render (function debug-menu-item-var int int int symbol debug-menu-item-var)) +(define-extern debug-menu-make-from-template (function debug-menu-context pair debug-menu-node)) +(define-extern debug-menu-append-item (function debug-menu debug-menu-item debug-menu-item)) +(define-extern debug-menu-context-set-root-menu (function debug-menu-context debug-menu debug-menu-context)) +(define-extern debug-menu-func-decode (function object function)) +(define-extern debug-menu-item-var-make-int (function debug-menu-item-var (function int int int int int) int symbol int int symbol debug-menu-item-var)) +(define-extern debug-menu-item-var-make-float (function debug-menu-item-var (function int int float float int) float symbol float float symbol debug-menu-item-var)) +(define-extern debug-menu-rebuild (function debug-menu debug-menu)) +(define-extern debug-menu-context-default-selection (function debug-menu-context symbol debug-menu-context)) +(define-extern debug-menu-item-get-max-width (function debug-menu-item debug-menu int)) +(define-extern debug-menu-remove-all-items (function debug-menu debug-menu)) +(define-extern debug-menu-find-from-template (function debug-menu-context pair debug-menu)) +(define-extern debug-menus-handler (function debug-menu-context debug-menu-context)) ;; ---------------------- @@ -19350,11 +19343,11 @@ (define-extern real-main-draw-hook function) (define-extern error-sphere function) (define-extern draw-instance-info function) -(define-extern find-instance-by-name function) +(define-extern find-instance-by-name (function string instance)) ;; TODO - ret not verified (define-extern prototype-bucket-type function) (define-extern guard-band-cull function) (define-extern find-instance-by-index function) -(define-extern prototype-bucket-recalc-fields function) +(define-extern prototype-bucket-recalc-fields (function instance none)) ;; TODO - ret not confirmed (define-extern dma-add-process-drawable-hud function) (define-extern foreground-engine-execute function) (define-extern main-debug-hook function) @@ -19369,6 +19362,10 @@ (define-extern cave-cam-restore function) (define-extern paals-cam-restore function) +;; - Symbols + +(define-extern *edit-instance* string) + ;; - Unknowns ;;(define-extern syncv object) ;; unknown type @@ -19376,7 +19373,6 @@ ;;(define-extern *surrogate-dma-buffer* object) ;; unknown type ;;(define-extern *screen-shot* object) ;; unknown type ;;(define-extern *hud-lights* object) ;; unknown type -;;(define-extern *edit-instance* object) ;; unknown type ;;(define-extern *instance-mem-usage* object) ;; unknown type ;;(define-extern *add-sphere* object) ;; unknown type ;;(define-extern *generic-effect-mode* object) ;; unknown type @@ -19454,7 +19450,7 @@ (define-extern entity-by-type (function type entity-actor)) (define-extern scf-get-territory (function int)) (define-extern pause-allowed? (function symbol)) -(define-extern menu-respond-to-pause (function int)) +(define-extern menu-respond-to-pause (function symbol)) (define-extern hide-progress-screen (function int)) (define-extern set-letterbox-frames (function uint uint)) (define-extern letterbox (function none)) @@ -21119,7 +21115,7 @@ ;;(define-extern anim-tester-process object) ;; unknown type ;;(define-extern anim-test-field-highlight-lw object) ;; unknown type ;;(define-extern *DISP_LIST-bank* object) ;; unknown type -;;(define-extern *debug-menu-context* object) ;; unknown type +(define-extern *debug-menu-context* debug-menu-context) ;; ---------------------- @@ -21207,79 +21203,79 @@ ;; - Functions -(define-extern build-continue-menu function) -(define-extern debug-menu-make-camera-menu function) -(define-extern debug-menu-make-shader-menu function) -(define-extern debug-menu-make-instance-menu function) -(define-extern debug-menu-make-task-menu function) -(define-extern dm-current-continue function) -(define-extern dm-task-get-money function) -(define-extern dm-levitator-ready function) -(define-extern dm-lavabike-ready function) -(define-extern dm-give-all-cells function) -(define-extern debug-menu-make-task-unknown-menu function) -(define-extern debug-menu-make-task-need-hint-menu function) -(define-extern debug-menu-make-task-need-introduction-menu function) -(define-extern debug-menu-make-task-need-reminder-a-menu function) -(define-extern debug-menu-make-task-need-reminder-menu function) -(define-extern debug-menu-make-task-need-reward-speech-menu function) -(define-extern debug-menu-make-task-need-resolution-menu function) -(define-extern dm-give-cell function) -(define-extern build-instance-list function) -(define-extern dm-edit-instance-toggle-pick-func function) -(define-extern dm-boolean-toggle-pick-func function) -(define-extern build-shader-list function) -(define-extern all-texture-tweak-adjust function) -(define-extern debug-menu-make-camera-mode-menu function) -(define-extern dm-cam-externalize function) -(define-extern dm-cam-render-float function) -(define-extern dm-cam-settings-func function) -(define-extern dm-cam-settings-func-int function) -(define-extern debug-create-cam-restore function) -(define-extern dm-cam-mode-func function) -(define-extern dm-instance-pick-func function) -(define-extern dm-enable-instance-func function) -(define-extern dm-shader-pick-func function) -(define-extern debug-menu-node: value of symbol ~A in task-controls is not a task-control~%":0 + "ERROR: dma tag has data in reserved bits ~X~%": 0, + "#: value of symbol ~A in task-controls is not a task-control~%": 0 } } diff --git a/decompiler/config/jak1_ntsc_black_label/label_types.jsonc b/decompiler/config/jak1_ntsc_black_label/label_types.jsonc index d6ccba5dbe..b509b93fc1 100644 --- a/decompiler/config/jak1_ntsc_black_label/label_types.jsonc +++ b/decompiler/config/jak1_ntsc_black_label/label_types.jsonc @@ -1130,8 +1130,25 @@ ["L195", "(array game-option)", true] ], - "tfrag-work": [ - ["L1", "tfrag-work", true] + "tfrag-work": [["L1", "tfrag-work", true]], + + "menu": [["L334", "float", true]], + + "default-menu": [ + ["L6251", "float", true], + ["L6252", "float", true], + ["L6253", "float", true], + ["L6254", "float", true], + ["L6256", "float", true], + ["L6257", "float", true], + ["L6264", "float", true], + ["L6267", "float", true], + ["L6268", "(array int)", true, 1] // printed as a float + ], + + "hint-control": [ + ["L45", "(array task-hint-control-group)", true], + ["L100", "(array level-hint-control)", true] ], // please do not add things after this entry! git is dumb. diff --git a/decompiler/config/jak1_ntsc_black_label/stack_structures.jsonc b/decompiler/config/jak1_ntsc_black_label/stack_structures.jsonc index 7e873b3228..973fd278cd 100644 --- a/decompiler/config/jak1_ntsc_black_label/stack_structures.jsonc +++ b/decompiler/config/jak1_ntsc_black_label/stack_structures.jsonc @@ -396,6 +396,28 @@ "draw-ocean-transition": [[16, "sphere"]], + "dm-cam-mode-func": [[16, "event-message-block"]], + + "dm-cam-settings-func": [[16, "event-message-block"]], + + "dm-cam-render-float": [[16, "event-message-block"]], + + "debug-create-cam-restore": [[16, "euler-angles"]], + + "dm-task-resolution": [[16, "event-message-block"]], + + "dm-task-get-money": [[16, "event-message-block"]], + + "dm-give-all-cells": [[16, "event-message-block"]], + + "dm-give-cell": [[16, "event-message-block"]], + + "(anon-function 13 default-menu)": [[16, "event-message-block"]], + + "(anon-function 12 default-menu)": [[16, "event-message-block"]], + + "(anon-function 11 default-menu)": [[16, "event-message-block"]], + "(method 22 level)": [[16, "event-message-block"]], "(method 9 level)": [[16, "event-message-block"]], "(method 10 load-state)": [[16, "event-message-block"]], @@ -408,8 +430,6 @@ [160, "vector"] ], - "draw-ocean-transition": [[16, "sphere"]], - "(anon-function 494 task-control)": [[16, "event-message-block"]], "(anon-function 493 task-control)": [[16, "event-message-block"]], "(anon-function 480 task-control)": [[16, "event-message-block"]], diff --git a/decompiler/config/jak1_ntsc_black_label/type_casts.jsonc b/decompiler/config/jak1_ntsc_black_label/type_casts.jsonc index c8fe0394c0..cac7c0acb4 100644 --- a/decompiler/config/jak1_ntsc_black_label/type_casts.jsonc +++ b/decompiler/config/jak1_ntsc_black_label/type_casts.jsonc @@ -770,7 +770,7 @@ [[0, 99999], "s6", "process-drawable"] ], //"bg": [[[25, 52], "a0", "string"]], - + "(anon-function 29 process-drawable)": [[[0, 999], "s6", "process-drawable"]], "ja-done?": [[[0, 999], "s6", "process-drawable"]], "ja-min?": [[[0, 999], "s6", "process-drawable"]], @@ -785,7 +785,10 @@ "ja-group-size": [[[0, 999], "s6", "process-drawable"]], "ja-eval": [[[0, 999], "s6", "process-drawable"]], "ja-blend-eval": [[[0, 999], "s6", "process-drawable"]], - "ja-post": [[[0, 999], "s6", "process-drawable"], [54, "a1", "process"]], + "ja-post": [ + [[0, 999], "s6", "process-drawable"], + [54, "a1", "process"] + ], "transform-post": [[[0, 999], "s6", "process-drawable"]], "rider-trans": [[[0, 999], "s6", "process-drawable"]], "rider-post": [[[0, 999], "s6", "process-drawable"]], @@ -804,9 +807,7 @@ [[157, 162], "a1", "dma-packet"] ], - "(top-level-login task-control)" :[ - [165, "v1", "symbol"] - ], + "(top-level-login task-control)": [[165, "v1", "symbol"]], "task-control-reset": [ [[7, 13], "a0", "task-control"], @@ -890,11 +891,15 @@ [10, "s3", "continue-point"] ], - "(method 9 game-info)": [ - [[270, 286], "s2", "(function cpu-thread function object object object object pointer)"] - ], + "(method 9 game-info)": [ + [ + [270, 286], + "s2", + "(function cpu-thread function object object object object pointer)" + ] + ], - "(method 25 game-info)" :[ + "(method 25 game-info)": [ [4, "v1", "game-save-tag"], [53, "v1", "pointer"], [[7, 53], "v1", "game-save-tag"], @@ -946,6 +951,72 @@ [[203, 210], "s4", "game-save-tag"] ], + "debug-menu-item-var-update-display-str": [ + [[44, 49], "v1", "int"], + [[61, 69], "v1", "int"] + ], + + "debug-menu-item-get-max-width": [[[18, 27], "a0", "debug-menu-item-var"]], + + "debug-menu-send-msg": [ + [[3, 14], "s2", "debug-menu-item"], + [[14, 21], "s2", "debug-menu-item-submenu"] + ], + + "debug-menu-item-var-joypad-handler": [ + [29, "t9", "(function int int float float float)"], + [[39, 42], "a2", "int"], + [[40, 42], "a3", "int"], + [41, "t9", "(function int int int int int)"], + [175, "t9", "(function int int float float float)"], + [200, "t9", "(function int int int int int)"], + [138, "v1", "int"], + [143, "v1", "int"], + [[182, 187], "v1", "int"], + [[182, 187], "a1", "int"], + [[190, 194], "a0", "int"], + [[193, 195], "v1", "int"] + ], + + "debug-menu-find-from-template": [ + [3, "s4", "debug-menu"], + [[4, 8], "s4", "debug-menu-item"], + [[41, 44], "s4", "debug-menu-node"], + [[7, 12], "s5", "debug-menu-item"], + [23, "s5", "debug-menu-item-submenu"] + ], + + "debug-menu-func-decode": [[[12, 14], "a0", "symbol"]], + + "dm-cam-render-float": [[[71, 72], "v0", "float"]], + + "build-continue-menu": [[4, "v1", "symbol"]], + + "can-hint-be-played?": [ + [[25, 28], "a0", "level-hint"] // kinda a guess, but its the only process that makes sense + ], + + "debug-menu-rebuild": [[[4, 13], "a0", "debug-menu-item"]], + + "debug-menu-item-submenu-render": [[[39, 44], "v1", "dma-packet"]], + + "debug-menu-item-function-render": [[[46, 51], "v1", "dma-packet"]], + + "debug-menu-item-flag-render": [[[44, 49], "v1", "dma-packet"]], + + "debug-menu-render": [ + [[45, 48], "v1", "dma-packet"], + [[106, 110], "v1", "dma-packet"] + ], + + "debug-menu-item-var-msg": [ + [52, "t9", "(function int int float float float)"], + [64, "t9", "(function int int int int int)"] + ], + + "debug-menu-item-var-make-int": [ + [21, "t9", "(function int int int int int)"] + ], "placeholder-do-not-add-below": [] } diff --git a/decompiler/config/jak1_ntsc_black_label/var_names.jsonc b/decompiler/config/jak1_ntsc_black_label/var_names.jsonc index 349e9e2a32..d9e5c76278 100644 --- a/decompiler/config/jak1_ntsc_black_label/var_names.jsonc +++ b/decompiler/config/jak1_ntsc_black_label/var_names.jsonc @@ -2209,5 +2209,11 @@ "s2-1":"prog-lev-idx", "a2-13":"lev-name" } + }, + + "debug-menu-func-decode": { + "vars": { + "v0-0": ["ret-val", "symbol"] + } } } diff --git a/goal_src/engine/collide/collide-target-h.gc b/goal_src/engine/collide/collide-target-h.gc index 58654a79a6..5e9cea9072 100644 --- a/goal_src/engine/collide/collide-target-h.gc +++ b/goal_src/engine/collide/collide-target-h.gc @@ -32,6 +32,7 @@ (deftype control-info (collide-shape-moving) ( + (some-quaternion quaternion :offset 496) (unknown-vector00 vector :inline :offset 576) (unknown-surface surface :offset 660) (unknown-symbol symbol :offset 664) diff --git a/goal_src/engine/debug/debug.gc b/goal_src/engine/debug/debug.gc index 47cc9ef077..0834ab3b36 100644 --- a/goal_src/engine/debug/debug.gc +++ b/goal_src/engine/debug/debug.gc @@ -394,7 +394,7 @@ (s5-0 (-> s3-0 base)) ) (let - ((v1-9 + ((a2-2 (new 'stack 'font-context @@ -410,9 +410,11 @@ ) ) ) - (set! (-> v1-9 origin z) (the float (/ (-> s2-0 z) 16))) + (let ((v1-9 a2-2)) + (set! (-> v1-9 origin z) (the float (/ (-> s2-0 z) 16))) + ) + (draw-string arg1 s3-0 a2-2) ) - (draw-string arg1 s3-0) (let ((a3-4 (-> s3-0 base))) (let ((v1-11 (the-as dma-packet (-> s3-0 base)))) (set! (-> v1-11 dma) (new 'static 'dma-tag :id (dma-tag-id next))) diff --git a/goal_src/engine/debug/menu.gc b/goal_src/engine/debug/menu.gc index 1adc379054..da769295d9 100644 --- a/goal_src/engine/debug/menu.gc +++ b/goal_src/engine/debug/menu.gc @@ -5,3 +5,1948 @@ ;; name in dgo: menu ;; dgos: GAME, ENGINE +;; this file is debug only +(when *debug-segment* +;; Added manually! +(declare-type debug-menu basic) +(declare-type debug-menu basic) +(declare-type debug-menu-item basic) + +;; definition of type debug-menu-context +(deftype debug-menu-context (basic) + ((is-active symbol :offset-assert 4) + (sel-length int32 :offset-assert 8) + (sel-menu debug-menu 8 :offset-assert 12) + (root-menu debug-menu :offset-assert 44) + (joypad-func (function basic none) :offset-assert 48) + (joypad-item basic :offset-assert 52) + (font font-context :offset-assert 56) + (is-hidden symbol :offset-assert 60) + ) + :method-count-assert 9 + :size-assert #x40 + :flag-assert #x900000040 + (:methods + (new (symbol type) _type_ 0) + ) + ) + +;; definition for method 0 of type debug-menu-context +(defmethod new debug-menu-context ((allocation symbol) (type-to-make type)) + (let + ((gp-0 + (object-new allocation type-to-make (the-as int (-> type-to-make size))) + ) + ) + (set! (-> gp-0 is-active) #f) + (set! (-> gp-0 is-hidden) #f) + (set! (-> gp-0 sel-length) 0) + (set! (-> gp-0 root-menu) #f) + (set! (-> gp-0 joypad-func) #f) + (set! (-> gp-0 joypad-item) #f) + (set! + (-> gp-0 font) + (new 'debug 'font-context *font-default-matrix* 0 0 0.0 0 (the-as uint 3)) + ) + gp-0 + ) + ) + +;; definition of type debug-menu-node +(deftype debug-menu-node (basic) + ((name string :offset-assert 4) + (parent debug-menu :offset-assert 8) + (refresh-delay int32 :offset-assert 12) + (refresh-ctr int32 :offset-assert 16) + ) + :method-count-assert 9 + :size-assert #x14 + :flag-assert #x900000014 + ) + +;; definition for method 2 of type debug-menu-node +(defmethod print debug-menu-node ((obj debug-menu-node)) + (format #t "#<~A ~A @ #x~X>" (-> obj type) (-> obj name) obj) + obj + ) + +;; definition of type debug-menu +(deftype debug-menu (debug-menu-node) + ((context debug-menu-context :offset-assert 20) + (selected-item debug-menu-item :offset-assert 24) + (pix-width int32 :offset-assert 28) + (pix-height int32 :offset-assert 32) + (items pair :offset-assert 36) + ) + :method-count-assert 9 + :size-assert #x28 + :flag-assert #x900000028 + (:methods + (new (symbol type debug-menu-context string) _type_ 0) + ) + ) + +;; definition for method 0 of type debug-menu +(defmethod + new + debug-menu + ((allocation symbol) + (type-to-make type) + (arg0 debug-menu-context) + (arg1 string) + ) + (let + ((v0-0 + (object-new allocation type-to-make (the-as int (-> type-to-make size))) + ) + ) + (set! (-> v0-0 context) arg0) + (set! (-> v0-0 name) arg1) + (set! (-> v0-0 parent) #f) + (set! (-> v0-0 selected-item) #f) + (set! (-> v0-0 items) '()) + v0-0 + ) + ) + +;; definition of type debug-menu-item +(deftype debug-menu-item (debug-menu-node) + ((id int32 :offset-assert 20) + ) + :method-count-assert 9 + :size-assert #x18 + :flag-assert #x900000018 + ) + +;; definition of type debug-menu-item-submenu +(deftype debug-menu-item-submenu (debug-menu-item) + ((submenu debug-menu :offset-assert 24) + ) + :method-count-assert 9 + :size-assert #x1c + :flag-assert #x90000001c + (:methods + (new (symbol type string debug-menu) _type_ 0) + ) + ) + +;; definition for method 0 of type debug-menu-item-submenu +(defmethod + new + debug-menu-item-submenu + ((allocation symbol) (type-to-make type) (arg0 string) (arg1 debug-menu)) + (let + ((v0-0 + (object-new allocation type-to-make (the-as int (-> type-to-make size))) + ) + ) + (set! (-> v0-0 name) arg0) + (set! (-> v0-0 parent) #f) + (set! (-> v0-0 refresh-delay) 0) + (set! (-> v0-0 refresh-ctr) (-> v0-0 refresh-delay)) + (set! (-> v0-0 submenu) arg1) + (set! (-> v0-0 submenu parent) (the-as debug-menu v0-0)) + v0-0 + ) + ) + +;; definition of type debug-menu-item-function +(deftype debug-menu-item-function (debug-menu-item) + ((activate-func (function int int) :offset-assert 24) + (hilite-timer int8 :offset-assert 28) + ) + :method-count-assert 9 + :size-assert #x1d + :flag-assert #x90000001d + (:methods + (new (symbol type string int function) _type_ 0) + ) + ) + +;; definition for method 0 of type debug-menu-item-function +(defmethod + new + debug-menu-item-function + ((allocation symbol) + (type-to-make type) + (arg0 string) + (arg1 int) + (arg2 function) + ) + (let + ((v0-0 + (object-new allocation type-to-make (the-as int (-> type-to-make size))) + ) + ) + (set! (-> v0-0 name) arg0) + (set! (-> v0-0 parent) #f) + (set! (-> v0-0 refresh-delay) 0) + (set! (-> v0-0 refresh-ctr) (-> v0-0 refresh-delay)) + (set! (-> v0-0 id) arg1) + (set! (-> v0-0 activate-func) (the-as (function int int) arg2)) + (set! (-> v0-0 hilite-timer) 0) + v0-0 + ) + ) + +;; definition of type debug-menu-item-flag +(deftype debug-menu-item-flag (debug-menu-item) + ((activate-func (function int int symbol) :offset-assert 24) + (is-on symbol :offset-assert 28) + ) + :method-count-assert 9 + :size-assert #x20 + :flag-assert #x900000020 + (:methods + (new (symbol type string symbol function) _type_ 0) + ) + ) + +;; definition for method 0 of type debug-menu-item-flag +(defmethod + new + debug-menu-item-flag + ((allocation symbol) + (type-to-make type) + (arg0 string) + (arg1 symbol) + (arg2 function) + ) + (let + ((v0-0 + (object-new allocation type-to-make (the-as int (-> type-to-make size))) + ) + ) + (set! (-> v0-0 name) arg0) + (set! (-> v0-0 parent) #f) + (set! (-> v0-0 refresh-delay) 23) + (set! (-> v0-0 refresh-ctr) (-> v0-0 refresh-delay)) + (set! (-> v0-0 id) (the-as int arg1)) + (set! (-> v0-0 activate-func) (the-as (function int int symbol) arg2)) + (set! (-> v0-0 is-on) #f) + v0-0 + ) + ) + +;; definition of type debug-menu-item-var +(deftype debug-menu-item-var (debug-menu-item) + ((display-str string :offset-assert 24) + (grabbed-joypad-p symbol :offset-assert 28) + (float-p symbol :offset-assert 32) + (range-p symbol :offset-assert 36) + (show-len int32 :offset-assert 40) + (inc-delay int32 :offset-assert 44) + (inc-delay-ctr int32 :offset-assert 48) + (step-delay-ctr int32 :offset-assert 52) + (inc-dir int32 :offset-assert 56) + (fval float :offset-assert 60) + (fundo-val float :offset-assert 64) + (frange-min float :offset-assert 68) + (frange-max float :offset-assert 72) + (fstart-inc float :offset-assert 76) + (fstep float :offset-assert 80) + (fprecision int32 :offset-assert 84) + (factivate-func function :offset-assert 88) + (ival int32 :offset 60) + (iundo-val int32 :offset 64) + (irange-min int32 :offset 68) + (irange-max int32 :offset 72) + (istart-inc int32 :offset 76) + (istep int32 :offset 80) + (ihex-p symbol :offset-assert 92) + (iactivate-func function :offset 88) + (ifloat-p symbol :offset-assert 96) + ) + :method-count-assert 9 + :size-assert #x64 + :flag-assert #x900000064 + (:methods + (new (symbol type string int int) _type_ 0) + ) + ) + +;; TODO - added manually + +(define-extern debug-menu-context-send-msg (function debug-menu-context int int debug-menu-context)) +(define-extern debug-menu-make-from-template (function debug-menu-context pair debug-menu-node)) +(define-extern debug-menu-item-send-msg (function debug-menu-item int debug-menu-item)) +(define-extern debug-menu-item-var-render (function debug-menu-item-var int int int symbol debug-menu-item-var)) +(define-extern debug-menu-send-msg (function debug-menu int symbol debug-menu)) + +;; definition for function debug-menu-item-var-update-display-str +(defun debug-menu-item-var-update-display-str ((arg0 debug-menu-item-var)) + (cond + ((-> arg0 float-p) + (format (clear (-> arg0 display-str)) "~f" (-> arg0 fval)) + ) + ((-> arg0 ihex-p) + (format (clear (-> arg0 display-str)) "x~X" (-> arg0 fval)) + ) + ((-> arg0 ifloat-p) + (cond + ((and + (< (the-as int (-> arg0 fval)) 0) + (< -100 (the-as int (-> arg0 fval))) + ) + (let ((s5-2 format) + (a0-8 (clear (-> arg0 display-str))) + (a1-2 "-0.~1d") + (v1-8 (abs (the-as int (-> arg0 fval)))) + ) + (s5-2 a0-8 a1-2 (/ (mod v1-8 100) 10)) + ) + ) + (else + (let ((s5-3 format) + (a0-10 (clear (-> arg0 display-str))) + (a1-3 "~2d.~1d") + (a2-6 (/ (the-as int (-> arg0 fval)) 100)) + (v1-12 (abs (the-as int (-> arg0 fval)))) + ) + (s5-3 a0-10 a1-3 a2-6 (/ (mod v1-12 100) 10)) + ) + ) + ) + ) + (else + (format (clear (-> arg0 display-str)) "~D" (-> arg0 fval)) + ) + ) + arg0 + ) + +;; definition for function debug-menu-item-var-make-int +(defun + debug-menu-item-var-make-int + ((arg0 debug-menu-item-var) + (arg1 (function int int int int int)) + (arg2 int) + (arg3 symbol) + (arg4 int) + (arg5 int) + (arg6 symbol) + ) + (set! (-> arg0 float-p) #f) + (set! (-> arg0 range-p) arg3) + (set! (-> arg0 frange-min) (the-as float arg4)) + (set! (-> arg0 frange-max) (the-as float arg5)) + (set! (-> arg0 fstart-inc) (the-as float arg2)) + (set! (-> arg0 fstep) (the-as float arg2)) + (set! (-> arg0 ihex-p) arg6) + (set! (-> arg0 factivate-func) arg1) + (cond + (arg3 + (set! (-> arg0 fval) (the-as float arg4)) + ) + (else + (set! (-> arg0 fval) (the-as float 0)) + 0 + ) + ) + (if arg1 + (set! + (-> arg0 fval) + (the-as + float + (arg1 + (-> arg0 id) + 3 + (the-as int (-> arg0 fval)) + (the-as int (-> arg0 fval)) + ) + ) + ) + ) + (debug-menu-item-var-update-display-str arg0) + arg0 + ) + +;; definition for function debug-menu-item-var-make-float +(defun + debug-menu-item-var-make-float + ((arg0 debug-menu-item-var) + (arg1 (function int int float float int)) + (arg2 float) + (arg3 symbol) + (arg4 float) + (arg5 float) + (arg6 symbol) + ) + (set! (-> arg0 float-p) #t) + (set! (-> arg0 range-p) arg3) + (set! (-> arg0 frange-min) arg4) + (set! (-> arg0 frange-max) arg5) + (set! (-> arg0 fstart-inc) arg2) + (set! (-> arg0 fstep) arg2) + (set! (-> arg0 fprecision) (the-as int arg6)) + (set! (-> arg0 factivate-func) arg1) + (if arg3 + (set! (-> arg0 fval) arg4) + (set! (-> arg0 fval) 0.0) + ) + (if arg1 + (set! + (-> arg0 fval) + (the float (arg1 (-> arg0 id) 3 (-> arg0 fval) (-> arg0 fval))) + ) + ) + (debug-menu-item-var-update-display-str arg0) + arg0 + ) + +;; definition for method 0 of type debug-menu-item-var +(defmethod + new + debug-menu-item-var + ((allocation symbol) (type-to-make type) (arg0 string) (arg1 int) (arg2 int)) + (let + ((gp-0 + (object-new allocation type-to-make (the-as int (-> type-to-make size))) + ) + ) + (let ((v1-2 (/ arg2 8))) + (set! (-> gp-0 name) arg0) + (set! (-> gp-0 parent) #f) + (set! (-> gp-0 refresh-delay) 31) + (set! (-> gp-0 refresh-ctr) (-> gp-0 refresh-delay)) + (set! (-> gp-0 id) arg1) + (set! v1-2 (cond + ((< 3 v1-2) + (empty) + v1-2 + ) + (else + 3 + ) + ) + ) + (set! (-> gp-0 show-len) v1-2) + ) + (set! (-> gp-0 grabbed-joypad-p) #f) + (set! (-> gp-0 ifloat-p) #f) + (set! (-> gp-0 display-str) (new 'debug 'string 64 (the-as string #f))) + (debug-menu-item-var-make-int + gp-0 + (the-as (function int int int int int) #f) + 1 + #t + 0 + 0 + #f + ) + gp-0 + ) + ) + +;; definition for function debug-menu-context-grab-joypad +(defun + debug-menu-context-grab-joypad + ((arg0 debug-menu-context) (arg1 basic) (arg2 function)) + (cond + ((-> arg0 joypad-func) + #f + ) + (else + (set! (-> arg0 joypad-func) (the-as (function basic none) arg2)) + (set! (-> arg0 joypad-item) arg1) + #t + ) + ) + ) + +;; definition for function debug-menu-context-release-joypad +(defun debug-menu-context-release-joypad ((arg0 debug-menu-context)) + (set! (-> arg0 joypad-func) #f) + (set! (-> arg0 joypad-item) #f) + #f + ) + +;; definition for function debug-menu-item-get-max-width +(defun debug-menu-item-get-max-width ((arg0 debug-menu-item) (arg1 debug-menu)) + (local-vars (v0-1 int)) + 0 + (cond + ((= (-> arg0 type) debug-menu-item-submenu) + (set! + v0-1 + (+ (the int (get-string-length (-> arg0 name) (-> arg1 context font))) 16) + ) + ) + ((= (-> arg0 type) debug-menu-item-var) + (set! + v0-1 + (the + int + (get-string-length + (the-as + string + (the-as + debug-menu-item-var + (-> (the-as debug-menu-item-var arg0) display-str) + ) + ) + (-> arg1 context font) + ) + ) + ) + ) + (else + (set! + v0-1 + (+ (the int (get-string-length (-> arg0 name) (-> arg1 context font))) 6) + ) + ) + ) + v0-1 + ) + +;; definition for function debug-menu-context-default-selection +(defun + debug-menu-context-default-selection + ((arg0 debug-menu-context) (arg1 symbol)) + (when (or (zero? (-> arg0 sel-length)) (not arg1)) + (let ((s5-0 (-> arg0 root-menu))) + (when (and s5-0 (not (null? (-> s5-0 items)))) + (let ((s4-0 (-> arg0 is-active))) + (if s4-0 + (debug-menu-context-send-msg arg0 2 0) + ) + (set! (-> arg0 sel-length) 1) + (set! (-> arg0 sel-menu 0) s5-0) + (set! + (-> s5-0 selected-item) + (the-as debug-menu-item (car (-> s5-0 items))) + ) + (if s4-0 + (debug-menu-context-send-msg arg0 1 0) + ) + ) + ) + ) + ) + arg0 + ) + +;; definition for function debug-menu-rebuild +(defun debug-menu-rebuild ((arg0 debug-menu)) + (let ((s4-0 0) + (s5-0 0) + ) + (let* ((s3-0 (-> arg0 items)) + (a0-1 (car s3-0)) + ) + (while (not (null? s3-0)) + (+! s5-0 1) + (set! (-> (the-as debug-menu-item a0-1) parent) arg0) + (set! + s4-0 + (max + s4-0 + (debug-menu-item-get-max-width (the-as debug-menu-item a0-1) arg0) + ) + ) + (set! s3-0 (cdr s3-0)) + (set! a0-1 (car s3-0)) + ) + ) + (set! (-> arg0 pix-width) (+ s4-0 18)) + (set! (-> arg0 pix-height) (+ (* s5-0 8) 6)) + ) + (let ((a0-2 (-> arg0 context))) + (debug-menu-context-default-selection a0-2 #t) + ) + arg0 + ) + +;; definition for function debug-menu-context-set-root-menu +(defun + debug-menu-context-set-root-menu + ((arg0 debug-menu-context) (arg1 debug-menu)) + (let ((s4-0 (-> arg0 is-active))) + (if s4-0 + (debug-menu-context-send-msg arg0 2 0) + ) + (set! (-> arg0 root-menu) arg1) + (debug-menu-context-default-selection arg0 #f) + (if s4-0 + (debug-menu-context-send-msg arg0 1 0) + ) + ) + arg0 + ) + +;; definition for function debug-menu-append-item +(defun debug-menu-append-item ((arg0 debug-menu) (arg1 debug-menu-item)) + (let* ((gp-0 (-> arg0 context)) + (s4-0 (-> gp-0 is-active)) + ) + (if s4-0 + (debug-menu-context-send-msg gp-0 2 0) + ) + (set! (-> arg1 parent) arg0) + (set! + (-> arg0 items) + (the-as pair (append! (-> arg0 items) (cons arg1 '()))) + ) + (debug-menu-rebuild arg0) + (if s4-0 + (debug-menu-context-send-msg gp-0 1 0) + ) + ) + arg1 + ) + +;; definition for function debug-menu-remove-all-items +(defun debug-menu-remove-all-items ((arg0 debug-menu)) + (let* ((gp-0 (-> arg0 context)) + (s4-0 (-> gp-0 is-active)) + ) + (if s4-0 + (debug-menu-context-send-msg gp-0 2 0) + ) + (set! (-> arg0 items) '()) + (set! (-> arg0 selected-item) #f) + (debug-menu-rebuild arg0) + (if s4-0 + (debug-menu-context-send-msg gp-0 1 0) + ) + ) + arg0 + ) + +;; definition for function debug-menu-func-decode +;; INFO: Return type mismatch object vs function. +(defun debug-menu-func-decode ((arg0 object)) + (let ((v1-1 (rtype-of arg0))) + (the-as function (the-as symbol (cond + ((or (= v1-1 symbol) (= v1-1 type)) + (the-as + symbol + (-> (the-as symbol arg0) value) + ) + ) + ((= v1-1 function) + (the-as symbol arg0) + ) + (else + (the-as symbol nothing) + ) + ) + ) + ) + ) + ) + +;; definition for function debug-menu-make-from-template +;; WARN: Stack slot load mismatch: defined as size 4, got size 16 + +;; WARN: Stack slot load mismatch: defined as size 4, got size 16 + +;; WARN: Stack slot load mismatch: defined as size 4, got size 16 + +;; WARN: Stack slot load mismatch: defined as size 4, got size 16 + +;; WARN: Stack slot load mismatch: defined as size 4, got size 16 + +;; WARN: Stack slot load mismatch: defined as size 4, got size 16 + +;; WARN: Stack slot load mismatch: defined as size 4, got size 16 + +;; WARN: Stack slot load mismatch: defined as size 4, got size 16 + +;; WARN: Stack slot load mismatch: defined as size 4, got size 16 + +;; WARN: Stack slot load mismatch: defined as size 4, got size 16 + +;; WARN: Stack slot load mismatch: defined as size 4, got size 16 + +;; WARN: Stack slot load mismatch: defined as size 4, got size 16 + +;; Used lq/sq +(defun debug-menu-make-from-template ((arg0 debug-menu-context) (arg1 pair)) + (local-vars + (s5-0 debug-menu-node) + (sv-16 object) + (sv-32 int) + (sv-48 float) + (sv-64 float) + (sv-80 float) + (sv-96 float) + ) + (if (or (not arg1) (null? arg1)) + (begin + (set! s5-0 (the-as debug-menu-node #f)) + (goto cfg-41) + ) + ) + (let ((s4-0 (car arg1)) + (s5-1 (car (cdr arg1))) + ) + (cond + ((= s4-0 'menu) + (let ((s4-1 (new 'debug 'debug-menu arg0 (the-as string s5-1)))) + (set! + s5-0 + (new 'debug 'debug-menu-item-submenu (the-as string s5-1) s4-1) + ) + (let* ((gp-1 (cdr (cdr arg1))) + (a1-3 (car gp-1)) + ) + (while (not (null? gp-1)) + (let ((a1-4 (debug-menu-make-from-template arg0 (the-as pair a1-3)))) + (if a1-4 + (debug-menu-append-item s4-1 (the-as debug-menu-item a1-4)) + ) + ) + (set! gp-1 (cdr gp-1)) + (set! a1-3 (car gp-1)) + ) + ) + ) + ) + ((= s4-0 'main-menu) + (set! s5-0 (new 'debug 'debug-menu arg0 (the-as string s5-1))) + (let* ((gp-2 (cdr (cdr arg1))) + (a1-6 (car gp-2)) + ) + (while (not (null? gp-2)) + (let ((a1-7 (debug-menu-make-from-template arg0 (the-as pair a1-6)))) + (if a1-7 + (debug-menu-append-item + (the-as debug-menu s5-0) + (the-as debug-menu-item a1-7) + ) + ) + ) + (set! gp-2 (cdr gp-2)) + (set! a1-6 (car gp-2)) + ) + ) + (debug-menu-context-set-root-menu arg0 (the-as debug-menu s5-0)) + ) + (else + (set! s5-0 (cond + ((= s4-0 'flag) + (new + 'debug + 'debug-menu-item-flag + (the-as string s5-1) + (the-as symbol (car (cdr (cdr arg1)))) + (debug-menu-func-decode (car (cdr (cdr (cdr arg1))))) + ) + ) + ((or (= s4-0 0) (= s4-0 'function)) + (new + 'debug + 'debug-menu-item-function + (the-as string s5-1) + (the-as int (car (cdr (cdr arg1)))) + (debug-menu-func-decode (car (cdr (cdr (cdr arg1))))) + ) + ) + ((= s4-0 'var) + (new + 'debug + 'debug-menu-item-var + (the-as string s5-1) + (the-as int (car (cdr (cdr arg1)))) + (the-as int (car (cdr (cdr (cdr arg1))))) + ) + ) + (else + (cond + ((or + (= s4-0 'int-var) + (= s4-0 'int-var-gat1) + (= s4-0 'hex-var) + ) + (set! + s5-0 + (new + 'debug + 'debug-menu-item-var + (the-as string s5-1) + (the-as int (car (cdr (cdr arg1)))) + (the-as int (ref arg1 4)) + ) + ) + (let ((s3-4 debug-menu-item-var-make-int) + (s2-3 (the-as debug-menu-item-var s5-0)) + (s1-3 + (debug-menu-func-decode (car (cdr (cdr (cdr arg1))))) + ) + (s0-1 (/ (the-as int (ref arg1 5)) 8)) + ) + (set! sv-16 (ref arg1 6)) + (set! sv-32 (/ (the-as int (ref arg1 7)) 8)) + (let ((t1-0 (/ (the-as int (ref arg1 8)) 8)) + (t2-0 (= s4-0 'hex-var)) + ) + (s3-4 + s2-3 + (the-as (function int int int int int) s1-3) + s0-1 + (the-as symbol sv-16) + sv-32 + t1-0 + t2-0 + ) + ) + ) + (set! (-> (the-as debug-menu-item-var s5-0) ifloat-p) #t) + s5-0 + ) + ((= s4-0 'float-var) + (set! + s5-0 + (new + 'debug + 'debug-menu-item-var + (the-as string s5-1) + (the-as int (car (cdr (cdr arg1)))) + (the-as int (ref arg1 4)) + ) + ) + (let ((s4-5 debug-menu-item-var-make-float) + (s3-6 (the-as debug-menu-item-var s5-0)) + (s2-5 + (debug-menu-func-decode (car (cdr (cdr (cdr arg1))))) + ) + (s1-5 (the float (/ (the-as int (ref arg1 5)) 8))) + (s0-2 (ref arg1 6)) + ) + (set! sv-48 (the float (/ (the-as int (ref arg1 7)) 8))) + (set! sv-64 (the float (/ (the-as int (ref arg1 8)) 8))) + (let ((t2-1 (/ (the-as int (ref arg1 9)) 8))) + (s4-5 + s3-6 + (the-as (function int int float float int) s2-5) + s1-5 + (the-as symbol s0-2) + sv-48 + sv-64 + (the-as symbol t2-1) + ) + ) + ) + s5-0 + ) + ((= s4-0 'float-fixed-var) + (set! + s5-0 + (new + 'debug + 'debug-menu-item-var + (the-as string s5-1) + (the-as int (car (cdr (cdr arg1)))) + (the-as int (ref arg1 4)) + ) + ) + (let ((s4-7 debug-menu-item-var-make-float) + (s3-8 (the-as debug-menu-item-var s5-0)) + (s2-7 + (debug-menu-func-decode (car (cdr (cdr (cdr arg1))))) + ) + (s1-7 + (* 0.001 (the float (/ (the-as int (ref arg1 5)) 8))) + ) + (s0-3 (ref arg1 6)) + ) + (set! + sv-80 + (* 0.001 (the float (/ (the-as int (ref arg1 7)) 8))) + ) + (set! + sv-96 + (* 0.001 (the float (/ (the-as int (ref arg1 8)) 8))) + ) + (let ((t2-2 (/ (the-as int (ref arg1 9)) 8))) + (s4-7 + s3-8 + (the-as (function int int float float int) s2-7) + s1-7 + (the-as symbol s0-3) + sv-80 + sv-96 + (the-as symbol t2-2) + ) + ) + ) + s5-0 + ) + (else + (the-as debug-menu-node #f) + ) + ) + ) + ) + ) + ) + ) + ) + (label cfg-41) + s5-0 + ) + +;; definition for function debug-menu-find-from-template +;; INFO: Return type mismatch object vs debug-menu. +(defun debug-menu-find-from-template ((arg0 debug-menu-context) (arg1 pair)) + (let ((s4-0 (the-as object (-> arg0 root-menu)))) + (while (begin + (label cfg-17) + (and + s4-0 + (type-type? (-> (the-as debug-menu-node s4-0) type) debug-menu) + (not (null? arg1)) + ) + ) + (let ((s3-0 (-> (the-as debug-menu s4-0) items)) + (s4-1 (car arg1)) + ) + (set! arg1 (cdr arg1)) + (let ((s5-0 (car s3-0))) + (while (not (null? s3-0)) + (if + (string= (the-as string s4-1) (-> (the-as debug-menu-item s5-0) name)) + (begin + (if (type-type? (rtype-of s5-0) debug-menu-item-submenu) + (set! s4-0 (-> (the-as debug-menu-item-submenu s5-0) submenu)) + (set! s4-0 s5-0) + ) + (goto cfg-17) + ) + ) + (set! s3-0 (cdr s3-0)) + (set! s5-0 (car s3-0)) + ) + ) + ) + (begin + (set! s4-0 #f) + (goto cfg-24) + ) + ) + (label cfg-24) + (the-as debug-menu s4-0) + ) + ) + +;; definition for function debug-menu-item-submenu-render +(defun + debug-menu-item-submenu-render + ((arg0 debug-menu-item-submenu) + (arg1 int) + (arg2 int) + (arg3 int) + (arg4 symbol) + ) + (let ((s5-0 (-> arg0 parent context font))) + (let ((v1-2 s5-0) + (a0-1 arg2) + ) + (set! (-> v1-2 origin x) (the float arg1)) + (set! (-> v1-2 origin y) (the float a0-1)) + ) + (set! (-> s5-0 color) (cond + ((zero? arg3) + 12 + ) + (arg4 + 11 + ) + (else + 13 + ) + ) + ) + (let* ((s3-0 (-> *display* frames (-> *display* on-screen) frame debug-buf)) + (s4-0 (-> s3-0 base)) + ) + (draw-string-adv (-> arg0 name) s3-0 s5-0) + (draw-string-adv "..." s3-0 s5-0) + (let ((a3-1 (-> s3-0 base))) + (let ((v1-7 (the-as object (-> s3-0 base)))) + (set! + (-> (the-as dma-packet v1-7) dma) + (new 'static 'dma-tag :id (dma-tag-id next)) + ) + (set! (-> (the-as dma-packet v1-7) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet v1-7) vif1) (new 'static 'vif-tag)) + (set! (-> s3-0 base) (&+ (the-as pointer v1-7) 16)) + ) + (dma-bucket-insert-tag + (-> *display* frames (-> *display* on-screen) frame bucket-group) + 68 + s4-0 + (the-as (pointer dma-tag) a3-1) + ) + ) + ) + ) + arg0 + ) + +;; definition for function debug-menu-item-function-render +(defun + debug-menu-item-function-render + ((arg0 debug-menu-item-function) + (arg1 int) + (arg2 int) + (arg3 int) + (arg4 symbol) + ) + (let ((v1-2 (-> arg0 parent context font))) + (let ((a0-1 v1-2) + (a1-1 arg2) + ) + (set! (-> a0-1 origin x) (the float arg1)) + (set! (-> a0-1 origin y) (the float a1-1)) + ) + (set! (-> v1-2 color) (cond + ((> (-> arg0 hilite-timer) 0) + (set! + (-> arg0 hilite-timer) + (+ (-> arg0 hilite-timer) -1) + ) + 10 + ) + ((< (-> arg0 hilite-timer) 0) + (set! + (-> arg0 hilite-timer) + (+ (-> arg0 hilite-timer) 1) + ) + 14 + ) + ((nonzero? arg3) + 13 + ) + (else + 12 + ) + ) + ) + (let* ((s4-0 (-> *display* frames (-> *display* on-screen) frame debug-buf)) + (s5-0 (-> s4-0 base)) + ) + (draw-string (-> arg0 name) s4-0 v1-2) + (let ((a3-1 (-> s4-0 base))) + (let ((v1-3 (the-as object (-> s4-0 base)))) + (set! + (-> (the-as dma-packet v1-3) dma) + (new 'static 'dma-tag :id (dma-tag-id next)) + ) + (set! (-> (the-as dma-packet v1-3) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet v1-3) vif1) (new 'static 'vif-tag)) + (set! (-> s4-0 base) (&+ (the-as pointer v1-3) 16)) + ) + (dma-bucket-insert-tag + (-> *display* frames (-> *display* on-screen) frame bucket-group) + 68 + s5-0 + (the-as (pointer dma-tag) a3-1) + ) + ) + ) + ) + arg0 + ) + +;; definition for function debug-menu-item-flag-render +(defun + debug-menu-item-flag-render + ((arg0 debug-menu-item-flag) (arg1 int) (arg2 int) (arg3 int) (arg4 symbol)) + (let ((v1-2 (-> arg0 parent context font))) + (let ((a0-1 v1-2) + (a1-1 arg2) + ) + (set! (-> a0-1 origin x) (the float arg1)) + (set! (-> a0-1 origin y) (the float a1-1)) + ) + (set! (-> v1-2 color) (cond + ((= (-> arg0 is-on) 'invalid) + 19 + ) + ((-> arg0 is-on) + (if (zero? arg3) + 15 + 16 + ) + ) + (else + (if (zero? arg3) + 17 + 18 + ) + ) + ) + ) + (let* ((s4-0 (-> *display* frames (-> *display* on-screen) frame debug-buf)) + (s5-0 (-> s4-0 base)) + ) + (draw-string (-> arg0 name) s4-0 v1-2) + (let ((a3-1 (-> s4-0 base))) + (let ((v1-3 (the-as object (-> s4-0 base)))) + (set! + (-> (the-as dma-packet v1-3) dma) + (new 'static 'dma-tag :id (dma-tag-id next)) + ) + (set! (-> (the-as dma-packet v1-3) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet v1-3) vif1) (new 'static 'vif-tag)) + (set! (-> s4-0 base) (&+ (the-as pointer v1-3) 16)) + ) + (dma-bucket-insert-tag + (-> *display* frames (-> *display* on-screen) frame bucket-group) + 68 + s5-0 + (the-as (pointer dma-tag) a3-1) + ) + ) + ) + ) + arg0 + ) + +;; definition for function debug-menu-item-var-render +;; ERROR: function was not converted to expressions. Cannot decompile. + +;; definition for function debug-menu-item-render +(defun + debug-menu-item-render + ((arg0 debug-menu-item) (arg1 int) (arg2 int) (arg3 int) (arg4 symbol)) + (when (> (-> arg0 refresh-delay) 0) + (set! (-> arg0 refresh-ctr) (+ (-> arg0 refresh-ctr) -1)) + (when (<= (-> arg0 refresh-ctr) 0) + (set! (-> arg0 refresh-ctr) (-> arg0 refresh-delay)) + (debug-menu-item-send-msg arg0 3) + ) + ) + (cond + ((= (-> arg0 type) debug-menu-item-submenu) + (debug-menu-item-submenu-render + (the-as debug-menu-item-submenu arg0) + arg1 + arg2 + arg3 + arg4 + ) + ) + ((= (-> arg0 type) debug-menu-item-function) + (debug-menu-item-function-render + (the-as debug-menu-item-function arg0) + arg1 + arg2 + arg3 + arg4 + ) + ) + ((= (-> arg0 type) debug-menu-item-flag) + (debug-menu-item-flag-render + (the-as debug-menu-item-flag arg0) + arg1 + arg2 + arg3 + arg4 + ) + ) + ((= (-> arg0 type) debug-menu-item-var) + (debug-menu-item-var-render + (the-as debug-menu-item-var arg0) + arg1 + arg2 + arg3 + arg4 + ) + ) + (else + (format 0 "ERROR: Found unknown item type!~%") + ) + ) + arg0 + ) + +;; definition for function debug-menu-render +;; Used lq/sq +(defun + debug-menu-render + ((arg0 debug-menu) (arg1 int) (arg2 int) (arg3 int) (arg4 int)) + (local-vars (sv-16 dma-buffer) (sv-32 pointer)) + (let ((v1-0 0)) + (let* ((a0-1 (-> arg0 items)) + (a1-1 (car a0-1)) + ) + (while (not (null? a0-1)) + (if (= a1-1 arg3) + (begin + (goto cfg-7) + ) + ) + (+! v1-0 1) + (set! a0-1 (cdr a0-1)) + (set! a1-1 (car a0-1)) + ) + ) + (label cfg-7) + (if (< 16 v1-0) + (set! arg2 (- arg2 (* (+ v1-0 -16) 8))) + ) + ) + (let* ((s0-0 (-> *display* frames (-> *display* on-screen) frame debug-buf)) + (s1-0 (-> s0-0 base)) + ) + (draw-sprite2d-xy + s0-0 + arg1 + arg2 + (-> arg0 pix-width) + (-> arg0 pix-height) + (new 'static 'rgba :a #x40) + ) + (let ((a3-2 (-> s0-0 base))) + (let ((v1-7 (the-as object (-> s0-0 base)))) + (set! + (-> (the-as dma-packet v1-7) dma) + (new 'static 'dma-tag :id (dma-tag-id next)) + ) + (set! (-> (the-as dma-packet v1-7) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet v1-7) vif1) (new 'static 'vif-tag)) + (set! (-> s0-0 base) (&+ (the-as pointer v1-7) 16)) + ) + (dma-bucket-insert-tag + (-> *display* frames (-> *display* on-screen) frame bucket-group) + 68 + s1-0 + (the-as (pointer dma-tag) a3-2) + ) + ) + ) + (let* ((s3-1 (+ arg1 3)) + (s2-1 (+ arg2 3)) + (s1-1 (-> arg0 items)) + (s0-1 (car s1-1)) + ) + (while (not (null? s1-1)) + (when (= s0-1 arg3) + (set! (-> arg0 context font color) (if (nonzero? arg4) + 13 + 12 + ) + ) + (let ((v1-16 (-> arg0 context font)) + (a1-5 s3-1) + (a0-18 s2-1) + ) + (set! (-> v1-16 origin x) (the float a1-5)) + (set! (-> v1-16 origin y) (the float a0-18)) + ) + (set! sv-16 (-> *display* frames (-> *display* on-screen) frame debug-buf)) + (set! sv-32 (-> sv-16 base)) + (draw-string ">" sv-16 (-> arg0 context font)) + (let ((a3-3 (-> sv-16 base))) + (let ((v1-26 (the-as object (-> sv-16 base)))) + (set! + (-> (the-as dma-packet v1-26) dma) + (new 'static 'dma-tag :id (dma-tag-id next)) + ) + (set! (-> (the-as dma-packet v1-26) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet v1-26) vif1) (new 'static 'vif-tag)) + (set! (-> sv-16 base) (&+ (the-as pointer v1-26) 16)) + ) + (dma-bucket-insert-tag + (-> *display* frames (-> *display* on-screen) frame bucket-group) + 68 + sv-32 + (the-as (pointer dma-tag) a3-3) + ) + ) + ) + (debug-menu-item-render + (the-as debug-menu-item s0-1) + (+ s3-1 12) + s2-1 + arg4 + (= s0-1 arg3) + ) + (+! s2-1 8) + (set! s1-1 (cdr s1-1)) + (set! s0-1 (car s1-1)) + ) + ) + arg0 + ) + +;; definition for function debug-menu-context-render +(defun debug-menu-context-render ((arg0 debug-menu-context)) + (let ((s4-0 6)) + (dotimes (s5-0 (-> arg0 sel-length)) + (let ((s3-0 (-> arg0 sel-menu s5-0))) + (let ((a3-0 (-> s3-0 selected-item))) + (debug-menu-render + s3-0 + s4-0 + 28 + (the-as int a3-0) + (+ (- -1 s5-0) (-> arg0 sel-length)) + ) + ) + (set! s4-0 (+ (+ s4-0 3) (-> s3-0 pix-width))) + ) + ) + ) + arg0 + ) + +;; definition for function debug-menu-context-select-next-or-prev-item +(defun + debug-menu-context-select-next-or-prev-item + ((arg0 debug-menu-context) (arg1 int)) + (local-vars (v1-6 object)) + (let ((s5-0 (-> arg0 sel-menu (+ (-> arg0 sel-length) -1)))) + (let ((a2-0 (-> s5-0 selected-item)) + (a0-1 '()) + (v1-4 '()) + ) + (let ((a3-0 (-> s5-0 items))) + (while (not (null? a3-0)) + (if (= (car a3-0) a2-0) + (begin + (set! v1-4 a3-0) + (goto cfg-7) + ) + ) + (set! a0-1 a3-0) + (set! a3-0 (cdr a3-0)) + ) + ) + (label cfg-7) + (if (null? v1-4) + (begin + (format 0 "ERROR: Couldn't find selected item in menu.~%") + (set! arg0 arg0) + (goto cfg-19) + ) + ) + (cond + ((>= arg1 0) + (if (null? (cdr v1-4)) + (set! v1-6 (car (-> s5-0 items))) + (set! v1-6 (car (cdr v1-4))) + ) + ) + (else + (if (null? a0-1) + (set! v1-6 (car (last (-> s5-0 items)))) + (set! v1-6 (car a0-1)) + ) + ) + ) + ) + (set! (-> s5-0 selected-item) (the-as debug-menu-item v1-6)) + ) + (label cfg-19) + arg0 + ) + +;; definition for function debug-menu-context-select-new-item +(defun debug-menu-context-select-new-item ((arg0 debug-menu-context) (arg1 int)) + (let* ((a2-0 (-> arg0 sel-menu (+ (-> arg0 sel-length) -1))) + (a1-1 (-> a2-0 selected-item)) + (a0-1 0) + (v1-4 -1) + ) + (let ((a2-1 (-> a2-0 items))) + (while (not (null? a2-1)) + (if (= (car a2-1) a1-1) + (set! v1-4 a0-1) + ) + (set! a2-1 (cdr a2-1)) + (+! a0-1 1) + ) + ) + (if (= v1-4 -1) + (begin + (format 0 "ERROR: Couldn't find selected item in menu.~%") + (set! arg0 arg0) + (goto cfg-25) + ) + ) + (cond + ((>= arg1 0) + (cond + ((= v1-4 (+ a0-1 -1)) + (set! arg1 1) + ) + ((>= (+ v1-4 arg1) a0-1) + (set! arg1 (+ (- -1 v1-4) a0-1)) + ) + ) + (dotimes (s4-0 arg1) + (debug-menu-context-select-next-or-prev-item arg0 1) + ) + ) + (else + (cond + ((zero? v1-4) + (set! arg1 -1) + ) + ((< (+ v1-4 arg1) 0) + (set! arg1 (- v1-4)) + ) + ) + (dotimes (s4-1 (- arg1)) + (debug-menu-context-select-next-or-prev-item arg0 -1) + ) + ) + ) + ) + (label cfg-25) + arg0 + ) + +;; definition for function debug-menu-context-open-submenu +(defun + debug-menu-context-open-submenu + ((arg0 debug-menu-context) (arg1 debug-menu)) + (let ((v1-0 (-> arg0 sel-length))) + (if (>= v1-0 8) + (return (begin + (format 0 "ERROR: Trying to exceed maximum menu depth!") + arg1 + ) + ) + ) + (if (null? (-> arg1 items)) + (return (begin + (format 0 "ERROR: Submenu has no items!") + arg1 + ) + ) + ) + (set! (-> arg0 sel-menu v1-0) arg1) + (if (not (-> arg1 selected-item)) + (set! (-> arg1 selected-item) (the-as debug-menu-item (-> arg1 items car))) + ) + (set! (-> arg0 sel-length) (+ v1-0 1)) + ) + (debug-menu-context-send-msg arg0 1 3) + ) + +;; definition for function debug-menu-context-close-submenu +(defun debug-menu-context-close-submenu ((arg0 debug-menu-context)) + (debug-menu-context-send-msg arg0 2 3) + (if (< 1 (-> arg0 sel-length)) + (set! (-> arg0 sel-length) (+ (-> arg0 sel-length) -1)) + ) + arg0 + ) + +;; definition for function debug-menu-item-submenu-msg +(defun debug-menu-item-submenu-msg ((arg0 debug-menu-item-submenu) (arg1 int)) + (when (= arg1 4) + (let ((a0-1 (-> arg0 parent context))) + (debug-menu-context-open-submenu a0-1 (-> arg0 submenu)) + ) + ) + arg0 + ) + +;; definition for function debug-menu-item-function-msg +(defun + debug-menu-item-function-msg + ((arg0 debug-menu-item-function) (arg1 symbol)) + (cond + ((= arg1 4) + (cond + ((-> arg0 activate-func) + (if ((-> arg0 activate-func) (-> arg0 id)) + (set! (-> arg0 hilite-timer) 6) + (set! (-> arg0 hilite-timer) -6) + ) + ) + (else + (set! (-> arg0 hilite-timer) -6) + ) + ) + ) + ((= arg1 2) + (set! (-> arg0 hilite-timer) 0) + 0 + ) + ) + arg0 + ) + +;; definition for function debug-menu-item-flag-msg +(defun debug-menu-item-flag-msg ((arg0 debug-menu-item-flag) (arg1 int)) + (cond + ((= arg1 4) + (if (-> arg0 activate-func) + (set! (-> arg0 is-on) ((-> arg0 activate-func) (-> arg0 id) 4)) + ) + (let ((a0-2 (-> arg0 parent context))) + (debug-menu-context-send-msg a0-2 3 2) + ) + ) + ((or (= arg1 3) (= arg1 1)) + (if (-> arg0 activate-func) + (set! (-> arg0 is-on) ((-> arg0 activate-func) (-> arg0 id) 3)) + ) + (set! (-> arg0 refresh-ctr) (-> arg0 refresh-delay)) + ) + ) + arg0 + ) + +;; definition for function debug-menu-item-var-joypad-handler +(defun debug-menu-item-var-joypad-handler ((arg0 debug-menu-item-var)) + (cond + ((zero? (logand (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons x))) + (let ((a0-1 (-> arg0 parent context))) + (debug-menu-context-release-joypad a0-1) + ) + (set! (-> arg0 grabbed-joypad-p) #f) + (when + (nonzero? + (logand (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons circle)) + ) + (cond + ((-> arg0 float-p) + (if (-> arg0 factivate-func) + (set! + (-> arg0 fval) + ((the-as (function int int float float float) (-> arg0 factivate-func)) + (-> arg0 id) + 4 + (-> arg0 fundo-val) + (-> arg0 fval) + ) + ) + ) + ) + (else + (if (-> arg0 factivate-func) + (set! + (-> arg0 fval) + (the-as + float + ((the-as (function int int int int int) (-> arg0 factivate-func)) + (-> arg0 id) + 4 + (the-as int (-> arg0 fundo-val)) + (the-as int (-> arg0 fval)) + ) + ) + ) + ) + ) + ) + (debug-menu-item-var-update-display-str arg0) + ) + (let ((a0-5 (-> arg0 parent context))) + (debug-menu-context-send-msg a0-5 3 2) + ) + ) + ((or + (nonzero? + (logand (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons right)) + ) + (nonzero? + (logand (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons left)) + ) + (nonzero? + (logand (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons down)) + ) + (nonzero? (logand (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons up))) + ) + (let ((v1-39 (cond + ((nonzero? + (logand + (-> *cpad-list* cpads 0 button0-abs 0) + (pad-buttons right) + ) + ) + 10 + ) + ((nonzero? + (logand + (-> *cpad-list* cpads 0 button0-abs 0) + (pad-buttons up) + ) + ) + 1 + ) + ((nonzero? + (logand + (-> *cpad-list* cpads 0 button0-abs 0) + (pad-buttons down) + ) + ) + -1 + ) + (else + -10 + ) + ) + ) + ) + (when (!= v1-39 (-> arg0 inc-dir)) + (set! (-> arg0 inc-dir) v1-39) + (set! (-> arg0 inc-delay) 15) + (set! (-> arg0 inc-delay-ctr) 0) + (set! (-> arg0 step-delay-ctr) 30) + (set! (-> arg0 fstep) (-> arg0 fstart-inc)) + (set! (-> arg0 fstep) (-> arg0 fstart-inc)) + ) + ) + (cond + ((<= (-> arg0 inc-delay-ctr) 0) + (if (> (-> arg0 inc-delay) 0) + (set! (-> arg0 inc-delay) (+ (-> arg0 inc-delay) -1)) + ) + (when (zero? (-> arg0 inc-delay)) + (cond + ((<= (-> arg0 step-delay-ctr) 0) + (set! (-> arg0 step-delay-ctr) 30) + (cond + ((-> arg0 float-p) + (if (< (-> arg0 fstep) 10000000.0) + (set! (-> arg0 fstep) (* 2.0 (-> arg0 fstep))) + ) + ) + (else + (if (< (the-as int (-> arg0 fstep)) #x989680) + (set! + (-> arg0 fstep) + (the-as float (* (the-as int (-> arg0 fstep)) 2)) + ) + ) + ) + ) + ) + (else + (set! (-> arg0 step-delay-ctr) (+ (-> arg0 step-delay-ctr) -1)) + ) + ) + ) + (set! (-> arg0 inc-delay-ctr) (-> arg0 inc-delay)) + (cond + ((-> arg0 float-p) + (when (-> arg0 factivate-func) + (let + ((f0-8 + (+ (-> arg0 fval) (* (the float (-> arg0 inc-dir)) (-> arg0 fstep))) + ) + ) + (if (-> arg0 range-p) + (set! + f0-8 + (fmin (fmax f0-8 (-> arg0 frange-min)) (-> arg0 frange-max)) + ) + ) + (set! + (-> arg0 fval) + ((the-as + (function int int float float float) + (-> arg0 factivate-func) + ) + (-> arg0 id) + 4 + f0-8 + (-> arg0 fval) + ) + ) + ) + ) + ) + (else + (when (-> arg0 factivate-func) + (let + ((a2-4 + (+ + (the-as int (-> arg0 fval)) + (* (-> arg0 inc-dir) (the-as int (-> arg0 fstep))) + ) + ) + ) + (if (-> arg0 range-p) + (set! + a2-4 + (min + (max a2-4 (the-as int (-> arg0 frange-min))) + (the-as int (-> arg0 frange-max)) + ) + ) + ) + (set! + (-> arg0 fval) + (the-as + float + ((the-as (function int int int int int) (-> arg0 factivate-func)) + (-> arg0 id) + 4 + a2-4 + (the-as int (-> arg0 fval)) + ) + ) + ) + ) + ) + ) + ) + (debug-menu-item-var-update-display-str arg0) + (let ((a0-20 (-> arg0 parent context))) + (debug-menu-context-send-msg a0-20 3 3) + ) + ) + (else + (set! (-> arg0 inc-delay-ctr) (+ (-> arg0 inc-delay-ctr) -1)) + ) + ) + ) + (else + (set! (-> arg0 inc-dir) 0) + 0 + ) + ) + arg0 + ) + +;; definition for function debug-menu-item-var-msg +(defun debug-menu-item-var-msg ((arg0 debug-menu-item-var) (arg1 int)) + (cond + ((= arg1 2) + (when (-> arg0 grabbed-joypad-p) + (let ((a0-1 (-> arg0 parent context))) + (debug-menu-context-release-joypad a0-1) + ) + (set! (-> arg0 grabbed-joypad-p) #f) + ) + ) + ((= arg1 4) + (when (not (-> arg0 grabbed-joypad-p)) + (let ((a0-2 (-> arg0 parent context))) + (when + (debug-menu-context-grab-joypad + a0-2 + arg0 + debug-menu-item-var-joypad-handler + ) + (set! (-> arg0 grabbed-joypad-p) #t) + (set! (-> arg0 fundo-val) (-> arg0 fval)) + (set! (-> arg0 fundo-val) (-> arg0 fval)) + (set! (-> arg0 inc-dir) 0) + 0 + ) + ) + ) + ) + ((or (= arg1 3) (= arg1 1)) + (cond + ((-> arg0 float-p) + (if (-> arg0 factivate-func) + (set! + (-> arg0 fval) + ((the-as (function int int float float float) (-> arg0 factivate-func)) + (-> arg0 id) + 3 + (-> arg0 fval) + (-> arg0 fval) + ) + ) + ) + ) + (else + (if (-> arg0 factivate-func) + (set! + (-> arg0 fval) + (the-as + float + ((the-as (function int int int int int) (-> arg0 factivate-func)) + (-> arg0 id) + 3 + (the-as int (-> arg0 fval)) + (the-as int (-> arg0 fval)) + ) + ) + ) + ) + ) + ) + (debug-menu-item-var-update-display-str arg0) + (set! (-> arg0 refresh-ctr) (-> arg0 refresh-delay)) + ) + ) + arg0 + ) + +;; definition for function debug-menu-item-send-msg +(defun debug-menu-item-send-msg ((arg0 debug-menu-item) (arg1 int)) + (cond + ((= (-> arg0 type) debug-menu-item-submenu) + (debug-menu-item-submenu-msg (the-as debug-menu-item-submenu arg0) arg1) + ) + ((= (-> arg0 type) debug-menu-item-function) + (debug-menu-item-function-msg + (the-as debug-menu-item-function arg0) + (the-as symbol arg1) + ) + ) + ((= (-> arg0 type) debug-menu-item-flag) + (debug-menu-item-flag-msg (the-as debug-menu-item-flag arg0) arg1) + ) + ((= (-> arg0 type) debug-menu-item-var) + (debug-menu-item-var-msg (the-as debug-menu-item-var arg0) arg1) + ) + (else + (format 0 "ERROR: Found unknown item type!~%") + ) + ) + arg0 + ) + +;; definition for function debug-menu-send-msg +(defun debug-menu-send-msg ((arg0 debug-menu) (arg1 int) (arg2 symbol)) + (let* ((s3-0 (-> arg0 items)) + (s2-0 (car s3-0)) + ) + (while (not (null? s3-0)) + (debug-menu-item-send-msg (the-as debug-menu-item s2-0) arg1) + (if + (and + arg2 + (= (-> (the-as debug-menu-item s2-0) type) debug-menu-item-submenu) + ) + (debug-menu-send-msg + (-> (the-as debug-menu-item-submenu s2-0) submenu) + arg1 + #t + ) + ) + (set! s3-0 (cdr s3-0)) + (set! s2-0 (car s3-0)) + ) + ) + arg0 + ) + +;; definition for function debug-menu-context-send-msg +(defun + debug-menu-context-send-msg + ((arg0 debug-menu-context) (arg1 int) (arg2 int)) + (cond + ((= arg2 1) + (debug-menu-send-msg (-> arg0 root-menu) arg1 #t) + ) + ((= arg2 2) + (when (-> arg0 is-active) + (dotimes (s4-0 (-> arg0 sel-length)) + (let ((a0-2 (-> arg0 sel-menu s4-0))) + (debug-menu-send-msg a0-2 arg1 #f) + ) + ) + ) + ) + ((= arg2 3) + (when (-> arg0 is-active) + (if (nonzero? (-> arg0 sel-length)) + (debug-menu-send-msg + (-> arg0 sel-menu (+ (-> arg0 sel-length) -1)) + arg1 + #f + ) + ) + ) + ) + ((zero? arg2) + (cond + ((= arg1 1) + (when (not (-> arg0 is-active)) + (set! (-> arg0 is-active) #t) + (debug-menu-context-send-msg arg0 1 2) + ) + ) + ((= arg1 2) + (when (-> arg0 is-active) + (debug-menu-context-send-msg arg0 2 2) + (set! (-> arg0 is-active) #f) + ) + ) + ) + ) + ) + arg0 + ) + +;; definition for function debug-menu-context-activate-selection +(defun debug-menu-context-activate-selection ((arg0 debug-menu-context)) + (let ((a0-1 (-> arg0 sel-menu (+ (-> arg0 sel-length) -1) selected-item))) + (debug-menu-item-send-msg a0-1 4) + ) + arg0 + ) + +;; definition for function debug-menus-default-joypad-func +(defun debug-menus-default-joypad-func ((arg0 debug-menu-context)) + (cond + ((nonzero? + (logand (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons square)) + ) + (cond + ((< 1 (-> arg0 sel-length)) + (debug-menu-context-close-submenu arg0) + ) + (else + ) + ) + ) + ((nonzero? (logand (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons x))) + (debug-menu-context-activate-selection arg0) + ) + ((nonzero? (logand (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons up))) + (debug-menu-context-select-new-item arg0 -1) + ) + ((nonzero? + (logand (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons down)) + ) + (debug-menu-context-select-new-item arg0 1) + ) + ((nonzero? + (logand (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons left)) + ) + (debug-menu-context-select-new-item arg0 -5) + ) + ((nonzero? + (logand (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons right)) + ) + (debug-menu-context-select-new-item arg0 5) + ) + ) + arg0 + ) + +;; definition for function debug-menus-active +(defun debug-menus-active ((arg0 debug-menu-context)) + (when (not (-> arg0 is-hidden)) + (if (-> arg0 joypad-func) + ((-> arg0 joypad-func) (-> arg0 joypad-item)) + (debug-menus-default-joypad-func arg0) + ) + (debug-menu-context-render arg0) + ) + arg0 + ) + +;; definition for function debug-menus-handler +(defun debug-menus-handler ((arg0 debug-menu-context)) + (if (-> arg0 is-active) + (debug-menus-active arg0) + ) + arg0 + ) + +;; failed to figure out what this is: +0 + +) + + + diff --git a/goal_src/engine/draw/drawable-ambient-h.gc b/goal_src/engine/draw/drawable-ambient-h.gc index ddfe663527..303707c007 100644 --- a/goal_src/engine/draw/drawable-ambient-h.gc +++ b/goal_src/engine/draw/drawable-ambient-h.gc @@ -64,7 +64,7 @@ :flag-assert #x10004000a8 (:methods (dummy-14 () none 14) - (dummy-15 () none 15) + (dummy-15 (_type_) symbol 15) ) ) diff --git a/goal_src/engine/game/game-info-h.gc b/goal_src/engine/game/game-info-h.gc index 5e3130e27b..6398a381a7 100644 --- a/goal_src/engine/game/game-info-h.gc +++ b/goal_src/engine/game/game-info-h.gc @@ -251,7 +251,7 @@ (text-ids-seen bit-array :offset-assert 112) (level-opened uint8 32 :offset-assert 116) (hint-control (array level-hint-control) :offset-assert 148) - (task-hint-control array :offset-assert 152) + (task-hint-control (array task-hint-control-group) :offset-assert 152) (total-deaths int32 :offset-assert 156) (continue-deaths int32 :offset-assert 160) (fuel-cell-deaths int32 :offset-assert 164) diff --git a/goal_src/engine/game/main-h.gc b/goal_src/engine/game/main-h.gc index b7bb76f839..c048e06592 100644 --- a/goal_src/engine/game/main-h.gc +++ b/goal_src/engine/game/main-h.gc @@ -99,7 +99,8 @@ (define *teleport-count* 0) (define *draw-hook* nothing) (define *debug-hook* nothing) -(define *menu-hook* nothing) +(declare-type debug-menu-context basic) +(define-extern *menu-hook* (function debug-menu-context)) (define *progress-hook* nothing) (define *dma-timeout-hook* nothing) diff --git a/goal_src/engine/game/task/hint-control-h.gc b/goal_src/engine/game/task/hint-control-h.gc index 9b6d9bafd5..fa980a4a7a 100644 --- a/goal_src/engine/game/task/hint-control-h.gc +++ b/goal_src/engine/game/task/hint-control-h.gc @@ -30,7 +30,7 @@ ) (deftype task-hint-control-group (structure) - ((tasks basic :offset-assert 0) + ((tasks (array task-hint-control) :offset-assert 0) ) :method-count-assert 9 :size-assert #x4 diff --git a/goal_src/engine/game/task/hint-control.gc b/goal_src/engine/game/task/hint-control.gc index 3d5bd306ac..156b15ef92 100644 --- a/goal_src/engine/game/task/hint-control.gc +++ b/goal_src/engine/game/task/hint-control.gc @@ -5,3 +5,530 @@ ;; name in dgo: hint-control ;; dgos: GAME, ENGINE +(define-extern *hint-semaphore* (pointer process-tree)) ;; likely a level-hint process + +;; failed to figure out what this is: +(set! + (-> *game-info* hint-control) + (the-as + (array level-hint-control) + (new + 'static + 'boxed-array + :type level-hint-control :length 25 :allocated-length 25 + (new 'static 'level-hint-control + :id #x917 + :num-attempts-before-playing 1 + :num-success-before-killing 3 + ) + (new 'static 'level-hint-control + :id #x90a + :num-attempts-before-playing 3 + :num-success-before-killing -1 + ) + (new 'static 'level-hint-control + :id #x284 + :num-attempts-before-playing 3 + :num-success-before-killing 3 + ) + (new 'static 'level-hint-control + :id #x285 + :num-attempts-before-playing 1 + :num-success-before-killing 1 + ) + (new 'static 'level-hint-control + :id #x251 + :num-attempts-before-playing 1 + :num-success-before-killing 1 + ) + (new 'static 'level-hint-control + :id #x2af + :num-attempts-before-playing 1 + :num-success-before-killing 1 + ) + (new 'static 'level-hint-control + :delay-before-playing #x384 + :id #x239 + :num-attempts-before-playing 1 + :num-success-before-killing 1 + ) + (new 'static 'level-hint-control + :delay-before-playing #x5dc + :id #x29d + :num-attempts-before-playing 1 + :num-success-before-killing -1 + ) + (new 'static 'level-hint-control + :delay-before-playing #x384 + :id #x25b + :num-attempts-before-playing 1 + :num-success-before-killing -1 + ) + (new 'static 'level-hint-control + :id #x2a4 + :num-attempts-before-playing 3 + :num-success-before-killing 1 + ) + (new 'static 'level-hint-control + :delay-before-playing #x384 + :id #x2aa + :num-attempts-before-playing 1 + :num-success-before-killing 1 + ) + (new 'static 'level-hint-control + :delay-before-playing #x5dc + :id #x33a + :num-attempts-before-playing 1 + :num-success-before-killing 1 + ) + (new 'static 'level-hint-control + :delay-before-playing #x1194 + :id #x34b + :num-attempts-before-playing 3 + :num-success-before-killing 2 + ) + (new 'static 'level-hint-control + :delay-before-playing #x4650 + :id #x34a + :num-attempts-before-playing 3 + :num-success-before-killing -1 + ) + (new 'static 'level-hint-control + :id #x34d + :num-attempts-before-playing 3 + :num-success-before-killing -1 + ) + (new 'static 'level-hint-control + :id #x345 + :num-attempts-before-playing 3 + :num-success-before-killing 2 + ) + (new 'static 'level-hint-control + :id #x352 + :num-attempts-before-playing 1 + :num-success-before-killing 1 + ) + (new 'static 'level-hint-control + :delay-before-playing #x2328 + :id #x347 + :num-attempts-before-playing 3 + :num-success-before-killing 1 + ) + (new 'static 'level-hint-control + :id #x34e + :num-attempts-before-playing 3 + :num-success-before-killing -1 + ) + (new 'static 'level-hint-control + :id #x444 + :num-attempts-before-playing 5 + :num-success-before-killing -1 + ) + (new 'static 'level-hint-control + :delay-before-playing #x384 + :id #x438 + :num-attempts-before-playing 1 + :num-success-before-killing -1 + ) + (new 'static 'level-hint-control + :id #x433 + :num-attempts-before-playing 4 + :num-success-before-killing -1 + ) + (new 'static 'level-hint-control + :id #x70d + :num-attempts-before-playing 1 + :num-success-before-killing 2 + ) + (new 'static 'level-hint-control + :delay-before-playing #x5dc + :id #x806 + :num-attempts-before-playing 1 + :num-success-before-killing 1 + ) + (new 'static 'level-hint-control + :delay-before-playing #x5dc + :id #x809 + :num-attempts-before-playing 1 + :num-success-before-killing 1 + ) + ) + ) + ) + +;; failed to figure out what this is: +(set! + (-> *game-info* task-hint-control) + (the-as + (array task-hint-control-group) + (new + 'static + 'boxed-array + :type task-hint-control-group :length 16 :allocated-length 16 + (new 'static 'task-hint-control-group + :tasks + (new + 'static + 'boxed-array + :type task-hint-control :length 3 :allocated-length 3 + (new 'static 'task-hint-control :task #x5c :delay #x2bf20) + (new 'static 'task-hint-control :task #x5d :delay #x57e40) + (new 'static 'task-hint-control :task #x5e :delay #x83d60) + ) + ) + (new 'static 'task-hint-control-group) + (new 'static 'task-hint-control-group + :tasks + (new + 'static + 'boxed-array + :type task-hint-control :length 3 :allocated-length 3 + (new 'static 'task-hint-control :task #x15 :delay #x41eb0) + (new 'static 'task-hint-control :task #x16 :delay #x83d60) + (new 'static 'task-hint-control :task #x13 :delay #xc5c10) + ) + ) + (new 'static 'task-hint-control-group + :tasks + (new + 'static + 'boxed-array + :type task-hint-control :length 2 :allocated-length 2 + (new 'static 'task-hint-control :task #x6 :delay #x57e40) + (new 'static 'task-hint-control :task #x8 :delay #xafc80) + ) + ) + (new 'static 'task-hint-control-group + :tasks + (new + 'static + 'boxed-array + :type task-hint-control :length 4 :allocated-length 4 + (new 'static 'task-hint-control :task #x18 :delay #x57e40) + (new 'static 'task-hint-control :task #x19 :delay #x83d60) + (new 'static 'task-hint-control :task #x1d :delay #xafc80) + (new 'static 'task-hint-control :task #x1e :delay #xdbba0) + ) + ) + (new 'static 'task-hint-control-group) + (new 'static 'task-hint-control-group) + (new 'static 'task-hint-control-group + :tasks + (new + 'static + 'boxed-array + :type task-hint-control :length 3 :allocated-length 3 + (new 'static 'task-hint-control :task #x33 :delay #x57e40) + (new 'static 'task-hint-control :task #x30 :delay #x83d60) + (new 'static 'task-hint-control :task #x2e :delay #xafc80) + ) + ) + (new 'static 'task-hint-control-group + :tasks + (new + 'static + 'boxed-array + :type task-hint-control :length 1 :allocated-length 1 + (new 'static 'task-hint-control :task #x26 :delay #xafc80) + ) + ) + (new 'static 'task-hint-control-group + :tasks + (new + 'static + 'boxed-array + :type task-hint-control :length 1 :allocated-length 1 + (new 'static 'task-hint-control :task #x38 :delay #xafc80) + ) + ) + (new 'static 'task-hint-control-group + :tasks + (new + 'static + 'boxed-array + :type task-hint-control :length 1 :allocated-length 1 + (new 'static 'task-hint-control :task #x6e :delay #x107ac0) + ) + ) + (new 'static 'task-hint-control-group + :tasks + (new + 'static + 'boxed-array + :type task-hint-control :length 1 :allocated-length 1 + (new 'static 'task-hint-control :task #x4a :delay #x107ac0) + ) + ) + (new 'static 'task-hint-control-group + :tasks + (new + 'static + 'boxed-array + :type task-hint-control :length 4 :allocated-length 4 + (new 'static 'task-hint-control :task #x42 :delay #x57e40) + (new 'static 'task-hint-control :task #x43 :delay #x83d60) + (new 'static 'task-hint-control :task #x3f :delay #xafc80) + (new 'static 'task-hint-control :task #x40 :delay #xdbba0) + ) + ) + (new 'static 'task-hint-control-group + :tasks + (new + 'static + 'boxed-array + :type task-hint-control :length 4 :allocated-length 4 + (new 'static 'task-hint-control :task #x50 :delay #x57e40) + (new 'static 'task-hint-control :task #x51 :delay #x83d60) + (new 'static 'task-hint-control :task #x52 :delay #xafc80) + (new 'static 'task-hint-control :task #x54 :delay #xdbba0) + ) + ) + (new 'static 'task-hint-control-group) + (new 'static 'task-hint-control-group) + ) + ) + ) + +;; definition for function find-hint-control-index +(defun find-hint-control-index ((arg0 level-hint-control)) + (let ((gp-0 -1)) + (let ((v1-2 (length (-> *game-info* hint-control)))) + (dotimes (a0-2 v1-2) + (when (= (-> *game-info* hint-control a0-2 id) arg0) + (set! gp-0 a0-2) + (set! a0-2 v1-2) + ) + ) + ) + gp-0 + ) + ) + +;; definition for function start-hint-timer +;; INFO: Return type mismatch int vs none. +(defun start-hint-timer ((arg0 level-hint-control)) + (let ((v1-0 (find-hint-control-index arg0))) + (when + (and + (>= v1-0 0) + (zero? (-> *game-info* hint-control v1-0 start-time)) + (!= (-> *game-info* hint-control v1-0 num-attempts-before-playing) 1) + ) + (set! + (-> *game-info* hint-control v1-0 start-time) + (-> *display* base-frame-counter) + ) + 0 + ) + ) + 0 + (none) + ) + +;; definition for function increment-success-for-hint +;; INFO: Return type mismatch int vs none. +(defun increment-success-for-hint ((arg0 level-hint-control)) + (let ((gp-0 (find-hint-control-index arg0))) + (when (>= gp-0 0) + (set! + (-> *game-info* hint-control gp-0 num-success) + (seekl (-> *game-info* hint-control gp-0 num-success) 127 1) + ) + 0 + ) + ) + 0 + (none) + ) + +;; definition for function can-hint-be-played? +;; WARN: disable def twice: 139. This may happen when a cond (no else) is nested inside of another conditional, but it should be rare. +(defun can-hint-be-played? ((arg0 int)) + (let ((v1-0 (not (str-is-playing?)))) + (if (and v1-0 (nonzero? arg0)) + (set! v1-0 (not (seen-text? *game-info* (the-as game-text-id arg0)))) + ) + (when v1-0 + (when *hint-semaphore* + (let ((v1-3 *hint-semaphore*)) + (set! v1-0 (dummy-15 (the-as level-hint (if v1-3 + (-> v1-3 0 self) + ) + ) + ) + ) + ) + 0 + ) + (when + (and + v1-0 + (< + (the-as + int + (- (-> *display* base-frame-counter) (-> *game-info* hint-play-time)) + ) + 30 + ) + ) + (set! v1-0 #f) + 0 + ) + (set! + v1-0 + (and + v1-0 + (not (-> *setting-control* current talking)) + (not (-> *setting-control* current spooling)) + (not (-> *setting-control* current hint)) + (not (-> *setting-control* current ambient)) + (>= + (the-as int (-> *display* base-frame-counter)) + (the-as int (-> *game-info* blackout-time)) + ) + ) + ) + 0 + ) + (cond + (v1-0 + (let ((v1-16 (find-hint-control-index (the-as level-hint-control arg0)))) + (cond + ((< v1-16 0) + #t + ) + (else + (let ((gp-1 (-> *game-info* hint-control v1-16)) + (a0-24 + (- + (-> *display* base-frame-counter) + (-> *game-info* hint-control v1-16 last-time-called) + ) + ) + (v1-21 #t) + ) + (if + (and + (= (-> gp-1 num-attempts-before-playing) 1) + (< (the-as int a0-24) 30) + ) + (set! (-> gp-1 start-time) (+ (-> gp-1 start-time) a0-24)) + ) + (cond + ((and + (!= (-> gp-1 num-attempts-before-playing) 1) + (nonzero? (-> gp-1 last-time-called)) + (< + (the-as + int + (- (-> *display* base-frame-counter) (-> gp-1 last-time-called)) + ) + 150 + ) + ) + (set! (-> gp-1 last-time-called) (-> *display* base-frame-counter)) + #f + ) + (else + (set! (-> gp-1 last-time-called) (-> *display* base-frame-counter)) + (when (nonzero? (-> gp-1 delay-before-playing)) + (if + (< + (the-as int (-> gp-1 start-time)) + (the-as int (-> gp-1 delay-before-playing)) + ) + (set! v1-21 #f) + ) + 0 + ) + (cond + (v1-21 + (set! (-> gp-1 num-attempts) (seekl (-> gp-1 num-attempts) 127 1)) + (and + (>= (-> gp-1 num-attempts) (-> gp-1 num-attempts-before-playing)) + (or + (= (-> gp-1 num-success-before-killing) -1) + (< (-> gp-1 num-success) (-> gp-1 num-success-before-killing)) + ) + ) + ) + (else + #f + ) + ) + ) + ) + ) + ) + ) + ) + ) + (else + #f + ) + ) + ) + ) + +;; definition for function reset-all-hint-controls +;; INFO: Return type mismatch int vs none. +(defun reset-all-hint-controls () + (let ((v1-2 (length (-> *game-info* hint-control)))) + (dotimes (a0-1 v1-2) + (let ((a1-2 (-> *game-info* hint-control a0-1))) + (set! (-> a1-2 start-time) (the-as uint 0)) + (set! (-> a1-2 last-time-called) (the-as uint 0)) + (set! (-> a1-2 num-attempts) 0) + (set! (-> a1-2 num-success) 0) + ) + 0 + ) + ) + 0 + (none) + ) + +;; TODO - defined in progress-static +(define-extern *level-task-data-remap* (array int32)) + +;; definition for function update-task-hints +;; INFO: Return type mismatch int vs none. +(defun update-task-hints () + (when *target* + (let ((a0-0 (+ (-> *target* current-level info index) -1)) + (v1-7 (-> *game-info* task-hint-control)) + ) + (when (and (>= a0-0 0) (< a0-0 (-> *level-task-data-remap* length))) + (let ((a0-3 (-> *level-task-data-remap* a0-0))) + (when (< a0-3 (-> v1-7 length)) + (let ((gp-0 (-> v1-7 a0-3 tasks))) + (when (and (!= gp-0 0) (nonzero? (-> gp-0 length))) + (let ((s5-0 (-> *game-info* in-level-time a0-3))) + (dotimes (s4-0 (-> gp-0 length)) + (let + ((v1-17 (get-task-status (the-as game-task (-> gp-0 s4-0 task))))) + (when + (or + (= v1-17 (task-status need-hint)) + (= v1-17 (task-status unknown)) + ) + (if (< (-> gp-0 s4-0 delay) s5-0) + (close-specific-task! + (the-as game-task (-> gp-0 s4-0 task)) + (task-status need-hint) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + 0 + (none) + ) diff --git a/goal_src/engine/gfx/font-h.gc b/goal_src/engine/gfx/font-h.gc index 227b5b38bd..b9534076c0 100644 --- a/goal_src/engine/gfx/font-h.gc +++ b/goal_src/engine/gfx/font-h.gc @@ -5,7 +5,6 @@ ;; name in dgo: font-h ;; dgos: GAME, ENGINE - (deftype char-verts (structure) ((pos vector 4 :inline :offset-assert 0) (color vector 4 :inline :offset-assert 64) @@ -663,5 +662,5 @@ ) -(defun-extern draw-string string dma-buffer int) +(define-extern draw-string (function string dma-buffer font-context int)) diff --git a/goal_src/engine/gfx/font.gc b/goal_src/engine/gfx/font.gc index 3188d00b3b..95b770feac 100644 --- a/goal_src/engine/gfx/font.gc +++ b/goal_src/engine/gfx/font.gc @@ -5,3 +5,6 @@ ;; name in dgo: font ;; dgos: GAME, ENGINE +;; TODO - for menu +(define-extern get-string-length (function string font-context float)) +(define-extern draw-string-adv (function string dma-buffer font-context none)) ;; TODO - ret value unconfirmed! diff --git a/goal_src/engine/gfx/tie/prototype-h.gc b/goal_src/engine/gfx/tie/prototype-h.gc index aeec235f65..c16c62c3d7 100644 --- a/goal_src/engine/gfx/tie/prototype-h.gc +++ b/goal_src/engine/gfx/tie/prototype-h.gc @@ -114,9 +114,10 @@ ) (deftype instance (drawable) - ((bucket-index uint16 :offset 6) - (origin matrix4h :inline :offset-assert 32) - (wind-index uint16 :offset 62) + ((bucket-index uint16 :offset 6) + (unknown uint32 :offset 8) ; TODO - from default-menu + (origin matrix4h :inline :offset-assert 32) ; TODO - this can also be a float, default-menu::lambda_62 + (wind-index uint16 :offset 62) ) :method-count-assert 18 :size-assert #x40 diff --git a/goal_src/engine/level/level-h.gc b/goal_src/engine/level/level-h.gc index e157f8fa75..a4324bb1eb 100644 --- a/goal_src/engine/level/level-h.gc +++ b/goal_src/engine/level/level-h.gc @@ -171,6 +171,7 @@ ;; There are actually three levels. level0 and level1 correspond to the actual buffered levels ;; The level-default seems to be a fake level that can possibly be used by renderers that ;; don't belong to any level, for example to render Jak. +(declare-type entity-links structure) (deftype level-group (basic) ((length int32 :offset-assert 4) (unknown-level-1 level :offset-assert 8) diff --git a/scripts/default-file-or-folder.py b/scripts/default-file-or-folder.py new file mode 100644 index 0000000000..02c4c58eb6 --- /dev/null +++ b/scripts/default-file-or-folder.py @@ -0,0 +1,15 @@ +# Windows doesn't have the GNU toolchain by default, making it hard to write Taskfiles that are cross-platform +# This "solves" that + +# Ensures it only will delete from the current directory + +import argparse +parser = argparse.ArgumentParser() +parser.add_argument("--path") +args = parser.parse_args() + +from os import path +import shutil + +if path.exists("./{}".format(args.path)): + shutil.rmtree("./{}".format(args.path)) diff --git a/test/decompiler/reference/engine/collide/collide-target-h_REF.gc b/test/decompiler/reference/engine/collide/collide-target-h_REF.gc index 562a6b4084..4e674ada5c 100644 --- a/test/decompiler/reference/engine/collide/collide-target-h_REF.gc +++ b/test/decompiler/reference/engine/collide/collide-target-h_REF.gc @@ -40,7 +40,8 @@ ;; definition of type control-info (deftype control-info (collide-shape-moving) - ((unknown-vector00 vector :inline :offset 576) + ((some-quaternion quaternion :offset 496) + (unknown-vector00 vector :inline :offset 576) (unknown-surface surface :offset 660) (unknown-symbol symbol :offset 664) (unknown-qword uint128 :offset 1136) diff --git a/test/decompiler/reference/engine/debug/menu_REF.gc b/test/decompiler/reference/engine/debug/menu_REF.gc new file mode 100644 index 0000000000..55d6256887 --- /dev/null +++ b/test/decompiler/reference/engine/debug/menu_REF.gc @@ -0,0 +1,2051 @@ +;;-*-Lisp-*- +(in-package goal) + +;; this file is debug only +(when *debug-segment* +;; definition of type debug-menu-context +(deftype debug-menu-context (basic) + ((is-active symbol :offset-assert 4) + (sel-length int32 :offset-assert 8) + (sel-menu debug-menu 8 :offset-assert 12) + (root-menu debug-menu :offset-assert 44) + (joypad-func (function basic none) :offset-assert 48) + (joypad-item basic :offset-assert 52) + (font font-context :offset-assert 56) + (is-hidden symbol :offset-assert 60) + ) + :method-count-assert 9 + :size-assert #x40 + :flag-assert #x900000040 + (:methods + (new (symbol type) _type_ 0) + ) + ) + +;; definition for method 3 of type debug-menu-context +(defmethod inspect debug-menu-context ((obj debug-menu-context)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~Tis-active: ~A~%" (-> obj is-active)) + (format #t "~Tsel-length: ~D~%" (-> obj sel-length)) + (format #t "~Tsel-menu[8] @ #x~X~%" (-> obj sel-menu)) + (format #t "~Troot-menu: ~A~%" (-> obj root-menu)) + (format #t "~Tjoypad-func: ~A~%" (-> obj joypad-func)) + (format #t "~Tjoypad-item: ~A~%" (-> obj joypad-item)) + (format #t "~Tfont: ~A~%" (-> obj font)) + (format #t "~Tis-hidden: ~A~%" (-> obj is-hidden)) + obj + ) + +;; definition for method 0 of type debug-menu-context +(defmethod new debug-menu-context ((allocation symbol) (type-to-make type)) + (let + ((gp-0 + (object-new allocation type-to-make (the-as int (-> type-to-make size))) + ) + ) + (set! (-> gp-0 is-active) #f) + (set! (-> gp-0 is-hidden) #f) + (set! (-> gp-0 sel-length) 0) + (set! (-> gp-0 root-menu) #f) + (set! (-> gp-0 joypad-func) #f) + (set! (-> gp-0 joypad-item) #f) + (set! + (-> gp-0 font) + (new 'debug 'font-context *font-default-matrix* 0 0 0.0 0 (the-as uint 3)) + ) + gp-0 + ) + ) + +;; definition of type debug-menu-node +(deftype debug-menu-node (basic) + ((name string :offset-assert 4) + (parent debug-menu :offset-assert 8) + (refresh-delay int32 :offset-assert 12) + (refresh-ctr int32 :offset-assert 16) + ) + :method-count-assert 9 + :size-assert #x14 + :flag-assert #x900000014 + ) + +;; definition for method 3 of type debug-menu-node +(defmethod inspect debug-menu-node ((obj debug-menu-node)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~Tname: ~A~%" (-> obj name)) + (format #t "~Tparent: ~A~%" (-> obj parent)) + (format #t "~Trefresh-delay: ~D~%" (-> obj refresh-delay)) + (format #t "~Trefresh-ctr: ~D~%" (-> obj refresh-ctr)) + obj + ) + +;; definition for method 2 of type debug-menu-node +(defmethod print debug-menu-node ((obj debug-menu-node)) + (format #t "#<~A ~A @ #x~X>" (-> obj type) (-> obj name) obj) + obj + ) + +;; definition of type debug-menu +(deftype debug-menu (debug-menu-node) + ((context debug-menu-context :offset-assert 20) + (selected-item debug-menu-item :offset-assert 24) + (pix-width int32 :offset-assert 28) + (pix-height int32 :offset-assert 32) + (items pair :offset-assert 36) + ) + :method-count-assert 9 + :size-assert #x28 + :flag-assert #x900000028 + (:methods + (new (symbol type debug-menu-context string) _type_ 0) + ) + ) + +;; definition for method 3 of type debug-menu +(defmethod inspect debug-menu ((obj debug-menu)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~Tname: ~A~%" (-> obj name)) + (format #t "~Tparent: ~A~%" (-> obj parent)) + (format #t "~Trefresh-delay: ~D~%" (-> obj refresh-delay)) + (format #t "~Trefresh-ctr: ~D~%" (-> obj refresh-ctr)) + (format #t "~Tcontext: ~A~%" (-> obj context)) + (format #t "~Tselected-item: ~A~%" (-> obj selected-item)) + (format #t "~Tpix-width: ~D~%" (-> obj pix-width)) + (format #t "~Tpix-height: ~D~%" (-> obj pix-height)) + (format #t "~Titems: ~A~%" (-> obj items)) + obj + ) + +;; definition for method 0 of type debug-menu +(defmethod + new + debug-menu + ((allocation symbol) + (type-to-make type) + (arg0 debug-menu-context) + (arg1 string) + ) + (let + ((v0-0 + (object-new allocation type-to-make (the-as int (-> type-to-make size))) + ) + ) + (set! (-> v0-0 context) arg0) + (set! (-> v0-0 name) arg1) + (set! (-> v0-0 parent) #f) + (set! (-> v0-0 selected-item) #f) + (set! (-> v0-0 items) '()) + v0-0 + ) + ) + +;; definition of type debug-menu-item +(deftype debug-menu-item (debug-menu-node) + ((id int32 :offset-assert 20) + ) + :method-count-assert 9 + :size-assert #x18 + :flag-assert #x900000018 + ) + +;; definition for method 3 of type debug-menu-item +(defmethod inspect debug-menu-item ((obj debug-menu-item)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~Tname: ~A~%" (-> obj name)) + (format #t "~Tparent: ~A~%" (-> obj parent)) + (format #t "~Trefresh-delay: ~D~%" (-> obj refresh-delay)) + (format #t "~Trefresh-ctr: ~D~%" (-> obj refresh-ctr)) + (format #t "~Tid: #x~X~%" (-> obj id)) + obj + ) + +;; definition of type debug-menu-item-submenu +(deftype debug-menu-item-submenu (debug-menu-item) + ((submenu debug-menu :offset-assert 24) + ) + :method-count-assert 9 + :size-assert #x1c + :flag-assert #x90000001c + (:methods + (new (symbol type string debug-menu) _type_ 0) + ) + ) + +;; definition for method 3 of type debug-menu-item-submenu +(defmethod inspect debug-menu-item-submenu ((obj debug-menu-item-submenu)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~Tname: ~A~%" (-> obj name)) + (format #t "~Tparent: ~A~%" (-> obj parent)) + (format #t "~Trefresh-delay: ~D~%" (-> obj refresh-delay)) + (format #t "~Trefresh-ctr: ~D~%" (-> obj refresh-ctr)) + (format #t "~Tid: #x~X~%" (-> obj id)) + (format #t "~Tsubmenu: ~A~%" (-> obj submenu)) + obj + ) + +;; definition for method 0 of type debug-menu-item-submenu +(defmethod + new + debug-menu-item-submenu + ((allocation symbol) (type-to-make type) (arg0 string) (arg1 debug-menu)) + (let + ((v0-0 + (object-new allocation type-to-make (the-as int (-> type-to-make size))) + ) + ) + (set! (-> v0-0 name) arg0) + (set! (-> v0-0 parent) #f) + (set! (-> v0-0 refresh-delay) 0) + (set! (-> v0-0 refresh-ctr) (-> v0-0 refresh-delay)) + (set! (-> v0-0 submenu) arg1) + (set! (-> v0-0 submenu parent) (the-as debug-menu v0-0)) + v0-0 + ) + ) + +;; definition of type debug-menu-item-function +(deftype debug-menu-item-function (debug-menu-item) + ((activate-func (function int int) :offset-assert 24) + (hilite-timer int8 :offset-assert 28) + ) + :method-count-assert 9 + :size-assert #x1d + :flag-assert #x90000001d + (:methods + (new (symbol type string int function) _type_ 0) + ) + ) + +;; definition for method 3 of type debug-menu-item-function +(defmethod inspect debug-menu-item-function ((obj debug-menu-item-function)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~Tname: ~A~%" (-> obj name)) + (format #t "~Tparent: ~A~%" (-> obj parent)) + (format #t "~Trefresh-delay: ~D~%" (-> obj refresh-delay)) + (format #t "~Trefresh-ctr: ~D~%" (-> obj refresh-ctr)) + (format #t "~Tid: #x~X~%" (-> obj id)) + (format #t "~Tactivate-func: ~A~%" (-> obj activate-func)) + (format #t "~Thilite-timer: ~D~%" (-> obj hilite-timer)) + obj + ) + +;; definition for method 0 of type debug-menu-item-function +(defmethod + new + debug-menu-item-function + ((allocation symbol) + (type-to-make type) + (arg0 string) + (arg1 int) + (arg2 function) + ) + (let + ((v0-0 + (object-new allocation type-to-make (the-as int (-> type-to-make size))) + ) + ) + (set! (-> v0-0 name) arg0) + (set! (-> v0-0 parent) #f) + (set! (-> v0-0 refresh-delay) 0) + (set! (-> v0-0 refresh-ctr) (-> v0-0 refresh-delay)) + (set! (-> v0-0 id) arg1) + (set! (-> v0-0 activate-func) (the-as (function int int) arg2)) + (set! (-> v0-0 hilite-timer) 0) + v0-0 + ) + ) + +;; definition of type debug-menu-item-flag +(deftype debug-menu-item-flag (debug-menu-item) + ((activate-func (function int int symbol) :offset-assert 24) + (is-on symbol :offset-assert 28) + ) + :method-count-assert 9 + :size-assert #x20 + :flag-assert #x900000020 + (:methods + (new (symbol type string symbol function) _type_ 0) + ) + ) + +;; definition for method 3 of type debug-menu-item-flag +(defmethod inspect debug-menu-item-flag ((obj debug-menu-item-flag)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~Tname: ~A~%" (-> obj name)) + (format #t "~Tparent: ~A~%" (-> obj parent)) + (format #t "~Trefresh-delay: ~D~%" (-> obj refresh-delay)) + (format #t "~Trefresh-ctr: ~D~%" (-> obj refresh-ctr)) + (format #t "~Tid: #x~X~%" (-> obj id)) + (format #t "~Tactivate-func: ~A~%" (-> obj activate-func)) + (format #t "~Tis-on: ~A~%" (-> obj is-on)) + obj + ) + +;; definition for method 0 of type debug-menu-item-flag +(defmethod + new + debug-menu-item-flag + ((allocation symbol) + (type-to-make type) + (arg0 string) + (arg1 symbol) + (arg2 function) + ) + (let + ((v0-0 + (object-new allocation type-to-make (the-as int (-> type-to-make size))) + ) + ) + (set! (-> v0-0 name) arg0) + (set! (-> v0-0 parent) #f) + (set! (-> v0-0 refresh-delay) 23) + (set! (-> v0-0 refresh-ctr) (-> v0-0 refresh-delay)) + (set! (-> v0-0 id) (the-as int arg1)) + (set! (-> v0-0 activate-func) (the-as (function int int symbol) arg2)) + (set! (-> v0-0 is-on) #f) + v0-0 + ) + ) + +;; definition of type debug-menu-item-var +(deftype debug-menu-item-var (debug-menu-item) + ((display-str string :offset-assert 24) + (grabbed-joypad-p symbol :offset-assert 28) + (float-p symbol :offset-assert 32) + (range-p symbol :offset-assert 36) + (show-len int32 :offset-assert 40) + (inc-delay int32 :offset-assert 44) + (inc-delay-ctr int32 :offset-assert 48) + (step-delay-ctr int32 :offset-assert 52) + (inc-dir int32 :offset-assert 56) + (fval float :offset-assert 60) + (fundo-val float :offset-assert 64) + (frange-min float :offset-assert 68) + (frange-max float :offset-assert 72) + (fstart-inc float :offset-assert 76) + (fstep float :offset-assert 80) + (fprecision int32 :offset-assert 84) + (factivate-func function :offset-assert 88) + (ival int32 :offset 60) + (iundo-val int32 :offset 64) + (irange-min int32 :offset 68) + (irange-max int32 :offset 72) + (istart-inc int32 :offset 76) + (istep int32 :offset 80) + (ihex-p symbol :offset-assert 92) + (iactivate-func function :offset 88) + (ifloat-p symbol :offset-assert 96) + ) + :method-count-assert 9 + :size-assert #x64 + :flag-assert #x900000064 + (:methods + (new (symbol type string int int) _type_ 0) + ) + ) + +;; definition for method 3 of type debug-menu-item-var +(defmethod inspect debug-menu-item-var ((obj debug-menu-item-var)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~Tname: ~A~%" (-> obj name)) + (format #t "~Tparent: ~A~%" (-> obj parent)) + (format #t "~Trefresh-delay: ~D~%" (-> obj refresh-delay)) + (format #t "~Trefresh-ctr: ~D~%" (-> obj refresh-ctr)) + (format #t "~Tid: #x~X~%" (-> obj id)) + (format #t "~Tdisplay-str: ~A~%" (-> obj display-str)) + (format #t "~Tgrabbed-joypad-p: ~A~%" (-> obj grabbed-joypad-p)) + (format #t "~Tfloat-p: ~A~%" (-> obj float-p)) + (format #t "~Trange-p: ~A~%" (-> obj range-p)) + (format #t "~Tshow-len: ~D~%" (-> obj show-len)) + (format #t "~Tinc-delay: ~D~%" (-> obj inc-delay)) + (format #t "~Tinc-delay-ctr: ~D~%" (-> obj inc-delay-ctr)) + (format #t "~Tstep-delay-ctr: ~D~%" (-> obj step-delay-ctr)) + (format #t "~Tinc-dir: ~D~%" (-> obj inc-dir)) + (format #t "~Tfval: ~f~%" (-> obj fval)) + (format #t "~Tfundo-val: ~f~%" (-> obj fundo-val)) + (format #t "~Tfrange-min: ~f~%" (-> obj frange-min)) + (format #t "~Tfrange-max: ~f~%" (-> obj frange-max)) + (format #t "~Tfstart-inc: ~f~%" (-> obj fstart-inc)) + (format #t "~Tfstep: ~f~%" (-> obj fstep)) + (format #t "~Tfprecision: ~D~%" (-> obj fprecision)) + (format #t "~Tfactivate-func: ~A~%" (-> obj factivate-func)) + (format #t "~Tival: ~D~%" (-> obj fval)) + (format #t "~Tiundo-val: ~D~%" (-> obj fundo-val)) + (format #t "~Tirange-min: ~D~%" (-> obj frange-min)) + (format #t "~Tirange-max: ~D~%" (-> obj frange-max)) + (format #t "~Tistart-inc: ~D~%" (-> obj fstart-inc)) + (format #t "~Tistep: ~D~%" (-> obj fstep)) + (format #t "~Tihex-p: ~A~%" (-> obj ihex-p)) + (format #t "~Tiactivate-func: ~A~%" (-> obj factivate-func)) + (format #t "~Tifloat-p: ~A~%" (-> obj ifloat-p)) + obj + ) + +;; definition for function debug-menu-item-var-update-display-str +(defun debug-menu-item-var-update-display-str ((arg0 debug-menu-item-var)) + (cond + ((-> arg0 float-p) + (format (clear (-> arg0 display-str)) "~f" (-> arg0 fval)) + ) + ((-> arg0 ihex-p) + (format (clear (-> arg0 display-str)) "x~X" (-> arg0 fval)) + ) + ((-> arg0 ifloat-p) + (cond + ((and + (< (the-as int (-> arg0 fval)) 0) + (< -100 (the-as int (-> arg0 fval))) + ) + (let ((s5-2 format) + (a0-8 (clear (-> arg0 display-str))) + (a1-2 "-0.~1d") + (v1-8 (abs (the-as int (-> arg0 fval)))) + ) + (s5-2 a0-8 a1-2 (/ (mod v1-8 100) 10)) + ) + ) + (else + (let ((s5-3 format) + (a0-10 (clear (-> arg0 display-str))) + (a1-3 "~2d.~1d") + (a2-6 (/ (the-as int (-> arg0 fval)) 100)) + (v1-12 (abs (the-as int (-> arg0 fval)))) + ) + (s5-3 a0-10 a1-3 a2-6 (/ (mod v1-12 100) 10)) + ) + ) + ) + ) + (else + (format (clear (-> arg0 display-str)) "~D" (-> arg0 fval)) + ) + ) + arg0 + ) + +;; definition for function debug-menu-item-var-make-int +(defun + debug-menu-item-var-make-int + ((arg0 debug-menu-item-var) + (arg1 (function int int int int int)) + (arg2 int) + (arg3 symbol) + (arg4 int) + (arg5 int) + (arg6 symbol) + ) + (set! (-> arg0 float-p) #f) + (set! (-> arg0 range-p) arg3) + (set! (-> arg0 frange-min) (the-as float arg4)) + (set! (-> arg0 frange-max) (the-as float arg5)) + (set! (-> arg0 fstart-inc) (the-as float arg2)) + (set! (-> arg0 fstep) (the-as float arg2)) + (set! (-> arg0 ihex-p) arg6) + (set! (-> arg0 factivate-func) arg1) + (cond + (arg3 + (set! (-> arg0 fval) (the-as float arg4)) + ) + (else + (set! (-> arg0 fval) (the-as float 0)) + 0 + ) + ) + (if arg1 + (set! + (-> arg0 fval) + (the-as + float + (arg1 + (-> arg0 id) + 3 + (the-as int (-> arg0 fval)) + (the-as int (-> arg0 fval)) + ) + ) + ) + ) + (debug-menu-item-var-update-display-str arg0) + arg0 + ) + +;; definition for function debug-menu-item-var-make-float +(defun + debug-menu-item-var-make-float + ((arg0 debug-menu-item-var) + (arg1 (function int int float float int)) + (arg2 float) + (arg3 symbol) + (arg4 float) + (arg5 float) + (arg6 symbol) + ) + (set! (-> arg0 float-p) #t) + (set! (-> arg0 range-p) arg3) + (set! (-> arg0 frange-min) arg4) + (set! (-> arg0 frange-max) arg5) + (set! (-> arg0 fstart-inc) arg2) + (set! (-> arg0 fstep) arg2) + (set! (-> arg0 fprecision) (the-as int arg6)) + (set! (-> arg0 factivate-func) arg1) + (if arg3 + (set! (-> arg0 fval) arg4) + (set! (-> arg0 fval) 0.0) + ) + (if arg1 + (set! + (-> arg0 fval) + (the float (arg1 (-> arg0 id) 3 (-> arg0 fval) (-> arg0 fval))) + ) + ) + (debug-menu-item-var-update-display-str arg0) + arg0 + ) + +;; definition for method 0 of type debug-menu-item-var +(defmethod + new + debug-menu-item-var + ((allocation symbol) (type-to-make type) (arg0 string) (arg1 int) (arg2 int)) + (let + ((gp-0 + (object-new allocation type-to-make (the-as int (-> type-to-make size))) + ) + ) + (let ((v1-2 (/ arg2 8))) + (set! (-> gp-0 name) arg0) + (set! (-> gp-0 parent) #f) + (set! (-> gp-0 refresh-delay) 31) + (set! (-> gp-0 refresh-ctr) (-> gp-0 refresh-delay)) + (set! (-> gp-0 id) arg1) + (set! v1-2 (cond + ((< 3 v1-2) + (empty) + v1-2 + ) + (else + 3 + ) + ) + ) + (set! (-> gp-0 show-len) v1-2) + ) + (set! (-> gp-0 grabbed-joypad-p) #f) + (set! (-> gp-0 ifloat-p) #f) + (set! (-> gp-0 display-str) (new 'debug 'string 64 (the-as string #f))) + (debug-menu-item-var-make-int + gp-0 + (the-as (function int int int int int) #f) + 1 + #t + 0 + 0 + #f + ) + gp-0 + ) + ) + +;; definition for function debug-menu-context-grab-joypad +(defun + debug-menu-context-grab-joypad + ((arg0 debug-menu-context) (arg1 basic) (arg2 function)) + (cond + ((-> arg0 joypad-func) + #f + ) + (else + (set! (-> arg0 joypad-func) (the-as (function basic none) arg2)) + (set! (-> arg0 joypad-item) arg1) + #t + ) + ) + ) + +;; definition for function debug-menu-context-release-joypad +(defun debug-menu-context-release-joypad ((arg0 debug-menu-context)) + (set! (-> arg0 joypad-func) #f) + (set! (-> arg0 joypad-item) #f) + #f + ) + +;; definition for function debug-menu-item-get-max-width +(defun debug-menu-item-get-max-width ((arg0 debug-menu-item) (arg1 debug-menu)) + (local-vars (v0-1 int)) + 0 + (cond + ((= (-> arg0 type) debug-menu-item-submenu) + (set! + v0-1 + (+ (the int (get-string-length (-> arg0 name) (-> arg1 context font))) 16) + ) + ) + ((= (-> arg0 type) debug-menu-item-var) + (set! + v0-1 + (the + int + (get-string-length + (the-as + string + (the-as + debug-menu-item-var + (-> (the-as debug-menu-item-var arg0) display-str) + ) + ) + (-> arg1 context font) + ) + ) + ) + ) + (else + (set! + v0-1 + (+ (the int (get-string-length (-> arg0 name) (-> arg1 context font))) 6) + ) + ) + ) + v0-1 + ) + +;; definition for function debug-menu-context-default-selection +(defun + debug-menu-context-default-selection + ((arg0 debug-menu-context) (arg1 symbol)) + (when (or (zero? (-> arg0 sel-length)) (not arg1)) + (let ((s5-0 (-> arg0 root-menu))) + (when (and s5-0 (not (null? (-> s5-0 items)))) + (let ((s4-0 (-> arg0 is-active))) + (if s4-0 + (debug-menu-context-send-msg arg0 2 0) + ) + (set! (-> arg0 sel-length) 1) + (set! (-> arg0 sel-menu 0) s5-0) + (set! + (-> s5-0 selected-item) + (the-as debug-menu-item (car (-> s5-0 items))) + ) + (if s4-0 + (debug-menu-context-send-msg arg0 1 0) + ) + ) + ) + ) + ) + arg0 + ) + +;; definition for function debug-menu-rebuild +(defun debug-menu-rebuild ((arg0 debug-menu)) + (let ((s4-0 0) + (s5-0 0) + ) + (let* ((s3-0 (-> arg0 items)) + (a0-1 (car s3-0)) + ) + (while (not (null? s3-0)) + (+! s5-0 1) + (set! (-> (the-as debug-menu-item a0-1) parent) arg0) + (set! + s4-0 + (max + s4-0 + (debug-menu-item-get-max-width (the-as debug-menu-item a0-1) arg0) + ) + ) + (set! s3-0 (cdr s3-0)) + (set! a0-1 (car s3-0)) + ) + ) + (set! (-> arg0 pix-width) (+ s4-0 18)) + (set! (-> arg0 pix-height) (+ (* s5-0 8) 6)) + ) + (let ((a0-2 (-> arg0 context))) + (debug-menu-context-default-selection a0-2 #t) + ) + arg0 + ) + +;; definition for function debug-menu-context-set-root-menu +(defun + debug-menu-context-set-root-menu + ((arg0 debug-menu-context) (arg1 debug-menu)) + (let ((s4-0 (-> arg0 is-active))) + (if s4-0 + (debug-menu-context-send-msg arg0 2 0) + ) + (set! (-> arg0 root-menu) arg1) + (debug-menu-context-default-selection arg0 #f) + (if s4-0 + (debug-menu-context-send-msg arg0 1 0) + ) + ) + arg0 + ) + +;; definition for function debug-menu-append-item +(defun debug-menu-append-item ((arg0 debug-menu) (arg1 debug-menu-item)) + (let* ((gp-0 (-> arg0 context)) + (s4-0 (-> gp-0 is-active)) + ) + (if s4-0 + (debug-menu-context-send-msg gp-0 2 0) + ) + (set! (-> arg1 parent) arg0) + (set! + (-> arg0 items) + (the-as pair (append! (-> arg0 items) (cons arg1 '()))) + ) + (debug-menu-rebuild arg0) + (if s4-0 + (debug-menu-context-send-msg gp-0 1 0) + ) + ) + arg1 + ) + +;; definition for function debug-menu-remove-all-items +(defun debug-menu-remove-all-items ((arg0 debug-menu)) + (let* ((gp-0 (-> arg0 context)) + (s4-0 (-> gp-0 is-active)) + ) + (if s4-0 + (debug-menu-context-send-msg gp-0 2 0) + ) + (set! (-> arg0 items) '()) + (set! (-> arg0 selected-item) #f) + (debug-menu-rebuild arg0) + (if s4-0 + (debug-menu-context-send-msg gp-0 1 0) + ) + ) + arg0 + ) + +;; definition for function debug-menu-func-decode +;; INFO: Return type mismatch object vs function. +(defun debug-menu-func-decode ((arg0 object)) + (let ((v1-1 (rtype-of arg0))) + (the-as function (the-as symbol (cond + ((or (= v1-1 symbol) (= v1-1 type)) + (the-as + symbol + (-> (the-as symbol arg0) value) + ) + ) + ((= v1-1 function) + (the-as symbol arg0) + ) + (else + (the-as symbol nothing) + ) + ) + ) + ) + ) + ) + +;; definition for function debug-menu-make-from-template +;; WARN: Stack slot load mismatch: defined as size 4, got size 16 + +;; WARN: Stack slot load mismatch: defined as size 4, got size 16 + +;; WARN: Stack slot load mismatch: defined as size 4, got size 16 + +;; WARN: Stack slot load mismatch: defined as size 4, got size 16 + +;; WARN: Stack slot load mismatch: defined as size 4, got size 16 + +;; WARN: Stack slot load mismatch: defined as size 4, got size 16 + +;; WARN: Stack slot load mismatch: defined as size 4, got size 16 + +;; WARN: Stack slot load mismatch: defined as size 4, got size 16 + +;; WARN: Stack slot load mismatch: defined as size 4, got size 16 + +;; WARN: Stack slot load mismatch: defined as size 4, got size 16 + +;; WARN: Stack slot load mismatch: defined as size 4, got size 16 + +;; WARN: Stack slot load mismatch: defined as size 4, got size 16 + +;; Used lq/sq +(defun debug-menu-make-from-template ((arg0 debug-menu-context) (arg1 pair)) + (local-vars + (s5-0 debug-menu-node) + (sv-16 object) + (sv-32 int) + (sv-48 float) + (sv-64 float) + (sv-80 float) + (sv-96 float) + ) + (if (or (not arg1) (null? arg1)) + (begin + (set! s5-0 (the-as debug-menu-node #f)) + (goto cfg-41) + ) + ) + (let ((s4-0 (car arg1)) + (s5-1 (car (cdr arg1))) + ) + (cond + ((= s4-0 'menu) + (let ((s4-1 (new 'debug 'debug-menu arg0 (the-as string s5-1)))) + (set! + s5-0 + (new 'debug 'debug-menu-item-submenu (the-as string s5-1) s4-1) + ) + (let* ((gp-1 (cdr (cdr arg1))) + (a1-3 (car gp-1)) + ) + (while (not (null? gp-1)) + (let ((a1-4 (debug-menu-make-from-template arg0 (the-as pair a1-3)))) + (if a1-4 + (debug-menu-append-item s4-1 (the-as debug-menu-item a1-4)) + ) + ) + (set! gp-1 (cdr gp-1)) + (set! a1-3 (car gp-1)) + ) + ) + ) + ) + ((= s4-0 'main-menu) + (set! s5-0 (new 'debug 'debug-menu arg0 (the-as string s5-1))) + (let* ((gp-2 (cdr (cdr arg1))) + (a1-6 (car gp-2)) + ) + (while (not (null? gp-2)) + (let ((a1-7 (debug-menu-make-from-template arg0 (the-as pair a1-6)))) + (if a1-7 + (debug-menu-append-item + (the-as debug-menu s5-0) + (the-as debug-menu-item a1-7) + ) + ) + ) + (set! gp-2 (cdr gp-2)) + (set! a1-6 (car gp-2)) + ) + ) + (debug-menu-context-set-root-menu arg0 (the-as debug-menu s5-0)) + ) + (else + (set! s5-0 (cond + ((= s4-0 'flag) + (new + 'debug + 'debug-menu-item-flag + (the-as string s5-1) + (the-as symbol (car (cdr (cdr arg1)))) + (debug-menu-func-decode (car (cdr (cdr (cdr arg1))))) + ) + ) + ((or (= s4-0 0) (= s4-0 'function)) + (new + 'debug + 'debug-menu-item-function + (the-as string s5-1) + (the-as int (car (cdr (cdr arg1)))) + (debug-menu-func-decode (car (cdr (cdr (cdr arg1))))) + ) + ) + ((= s4-0 'var) + (new + 'debug + 'debug-menu-item-var + (the-as string s5-1) + (the-as int (car (cdr (cdr arg1)))) + (the-as int (car (cdr (cdr (cdr arg1))))) + ) + ) + (else + (cond + ((or + (= s4-0 'int-var) + (= s4-0 'int-var-gat1) + (= s4-0 'hex-var) + ) + (set! + s5-0 + (new + 'debug + 'debug-menu-item-var + (the-as string s5-1) + (the-as int (car (cdr (cdr arg1)))) + (the-as int (ref arg1 4)) + ) + ) + (let ((s3-4 debug-menu-item-var-make-int) + (s2-3 (the-as debug-menu-item-var s5-0)) + (s1-3 + (debug-menu-func-decode (car (cdr (cdr (cdr arg1))))) + ) + (s0-1 (/ (the-as int (ref arg1 5)) 8)) + ) + (set! sv-16 (ref arg1 6)) + (set! sv-32 (/ (the-as int (ref arg1 7)) 8)) + (let ((t1-0 (/ (the-as int (ref arg1 8)) 8)) + (t2-0 (= s4-0 'hex-var)) + ) + (s3-4 + s2-3 + (the-as (function int int int int int) s1-3) + s0-1 + (the-as symbol sv-16) + sv-32 + t1-0 + t2-0 + ) + ) + ) + (set! (-> (the-as debug-menu-item-var s5-0) ifloat-p) #t) + s5-0 + ) + ((= s4-0 'float-var) + (set! + s5-0 + (new + 'debug + 'debug-menu-item-var + (the-as string s5-1) + (the-as int (car (cdr (cdr arg1)))) + (the-as int (ref arg1 4)) + ) + ) + (let ((s4-5 debug-menu-item-var-make-float) + (s3-6 (the-as debug-menu-item-var s5-0)) + (s2-5 + (debug-menu-func-decode (car (cdr (cdr (cdr arg1))))) + ) + (s1-5 (the float (/ (the-as int (ref arg1 5)) 8))) + (s0-2 (ref arg1 6)) + ) + (set! sv-48 (the float (/ (the-as int (ref arg1 7)) 8))) + (set! sv-64 (the float (/ (the-as int (ref arg1 8)) 8))) + (let ((t2-1 (/ (the-as int (ref arg1 9)) 8))) + (s4-5 + s3-6 + (the-as (function int int float float int) s2-5) + s1-5 + (the-as symbol s0-2) + sv-48 + sv-64 + (the-as symbol t2-1) + ) + ) + ) + s5-0 + ) + ((= s4-0 'float-fixed-var) + (set! + s5-0 + (new + 'debug + 'debug-menu-item-var + (the-as string s5-1) + (the-as int (car (cdr (cdr arg1)))) + (the-as int (ref arg1 4)) + ) + ) + (let ((s4-7 debug-menu-item-var-make-float) + (s3-8 (the-as debug-menu-item-var s5-0)) + (s2-7 + (debug-menu-func-decode (car (cdr (cdr (cdr arg1))))) + ) + (s1-7 + (* 0.001 (the float (/ (the-as int (ref arg1 5)) 8))) + ) + (s0-3 (ref arg1 6)) + ) + (set! + sv-80 + (* 0.001 (the float (/ (the-as int (ref arg1 7)) 8))) + ) + (set! + sv-96 + (* 0.001 (the float (/ (the-as int (ref arg1 8)) 8))) + ) + (let ((t2-2 (/ (the-as int (ref arg1 9)) 8))) + (s4-7 + s3-8 + (the-as (function int int float float int) s2-7) + s1-7 + (the-as symbol s0-3) + sv-80 + sv-96 + (the-as symbol t2-2) + ) + ) + ) + s5-0 + ) + (else + (the-as debug-menu-node #f) + ) + ) + ) + ) + ) + ) + ) + ) + (label cfg-41) + s5-0 + ) + +;; definition for function debug-menu-find-from-template +;; INFO: Return type mismatch object vs debug-menu. +(defun debug-menu-find-from-template ((arg0 debug-menu-context) (arg1 pair)) + (let ((s4-0 (the-as object (-> arg0 root-menu)))) + (while (begin + (label cfg-17) + (and + s4-0 + (type-type? (-> (the-as debug-menu-node s4-0) type) debug-menu) + (not (null? arg1)) + ) + ) + (let ((s3-0 (-> (the-as debug-menu s4-0) items)) + (s4-1 (car arg1)) + ) + (set! arg1 (cdr arg1)) + (let ((s5-0 (car s3-0))) + (while (not (null? s3-0)) + (if + (string= (the-as string s4-1) (-> (the-as debug-menu-item s5-0) name)) + (begin + (if (type-type? (rtype-of s5-0) debug-menu-item-submenu) + (set! s4-0 (-> (the-as debug-menu-item-submenu s5-0) submenu)) + (set! s4-0 s5-0) + ) + (goto cfg-17) + ) + ) + (set! s3-0 (cdr s3-0)) + (set! s5-0 (car s3-0)) + ) + ) + ) + (begin + (set! s4-0 #f) + (goto cfg-24) + ) + ) + (label cfg-24) + (the-as debug-menu s4-0) + ) + ) + +;; definition for function debug-menu-item-submenu-render +(defun + debug-menu-item-submenu-render + ((arg0 debug-menu-item-submenu) + (arg1 int) + (arg2 int) + (arg3 int) + (arg4 symbol) + ) + (let ((s5-0 (-> arg0 parent context font))) + (let ((v1-2 s5-0) + (a0-1 arg2) + ) + (set! (-> v1-2 origin x) (the float arg1)) + (set! (-> v1-2 origin y) (the float a0-1)) + ) + (set! (-> s5-0 color) (cond + ((zero? arg3) + 12 + ) + (arg4 + 11 + ) + (else + 13 + ) + ) + ) + (let* ((s3-0 (-> *display* frames (-> *display* on-screen) frame debug-buf)) + (s4-0 (-> s3-0 base)) + ) + (draw-string-adv (-> arg0 name) s3-0 s5-0) + (draw-string-adv "..." s3-0 s5-0) + (let ((a3-1 (-> s3-0 base))) + (let ((v1-7 (the-as object (-> s3-0 base)))) + (set! + (-> (the-as dma-packet v1-7) dma) + (new 'static 'dma-tag :id (dma-tag-id next)) + ) + (set! (-> (the-as dma-packet v1-7) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet v1-7) vif1) (new 'static 'vif-tag)) + (set! (-> s3-0 base) (&+ (the-as pointer v1-7) 16)) + ) + (dma-bucket-insert-tag + (-> *display* frames (-> *display* on-screen) frame bucket-group) + 68 + s4-0 + (the-as (pointer dma-tag) a3-1) + ) + ) + ) + ) + arg0 + ) + +;; definition for function debug-menu-item-function-render +(defun + debug-menu-item-function-render + ((arg0 debug-menu-item-function) + (arg1 int) + (arg2 int) + (arg3 int) + (arg4 symbol) + ) + (let ((v1-2 (-> arg0 parent context font))) + (let ((a0-1 v1-2) + (a1-1 arg2) + ) + (set! (-> a0-1 origin x) (the float arg1)) + (set! (-> a0-1 origin y) (the float a1-1)) + ) + (set! (-> v1-2 color) (cond + ((> (-> arg0 hilite-timer) 0) + (set! + (-> arg0 hilite-timer) + (+ (-> arg0 hilite-timer) -1) + ) + 10 + ) + ((< (-> arg0 hilite-timer) 0) + (set! + (-> arg0 hilite-timer) + (+ (-> arg0 hilite-timer) 1) + ) + 14 + ) + ((nonzero? arg3) + 13 + ) + (else + 12 + ) + ) + ) + (let* ((s4-0 (-> *display* frames (-> *display* on-screen) frame debug-buf)) + (s5-0 (-> s4-0 base)) + ) + (draw-string (-> arg0 name) s4-0 v1-2) + (let ((a3-1 (-> s4-0 base))) + (let ((v1-3 (the-as object (-> s4-0 base)))) + (set! + (-> (the-as dma-packet v1-3) dma) + (new 'static 'dma-tag :id (dma-tag-id next)) + ) + (set! (-> (the-as dma-packet v1-3) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet v1-3) vif1) (new 'static 'vif-tag)) + (set! (-> s4-0 base) (&+ (the-as pointer v1-3) 16)) + ) + (dma-bucket-insert-tag + (-> *display* frames (-> *display* on-screen) frame bucket-group) + 68 + s5-0 + (the-as (pointer dma-tag) a3-1) + ) + ) + ) + ) + arg0 + ) + +;; definition for function debug-menu-item-flag-render +(defun + debug-menu-item-flag-render + ((arg0 debug-menu-item-flag) (arg1 int) (arg2 int) (arg3 int) (arg4 symbol)) + (let ((v1-2 (-> arg0 parent context font))) + (let ((a0-1 v1-2) + (a1-1 arg2) + ) + (set! (-> a0-1 origin x) (the float arg1)) + (set! (-> a0-1 origin y) (the float a1-1)) + ) + (set! (-> v1-2 color) (cond + ((= (-> arg0 is-on) 'invalid) + 19 + ) + ((-> arg0 is-on) + (if (zero? arg3) + 15 + 16 + ) + ) + (else + (if (zero? arg3) + 17 + 18 + ) + ) + ) + ) + (let* ((s4-0 (-> *display* frames (-> *display* on-screen) frame debug-buf)) + (s5-0 (-> s4-0 base)) + ) + (draw-string (-> arg0 name) s4-0 v1-2) + (let ((a3-1 (-> s4-0 base))) + (let ((v1-3 (the-as object (-> s4-0 base)))) + (set! + (-> (the-as dma-packet v1-3) dma) + (new 'static 'dma-tag :id (dma-tag-id next)) + ) + (set! (-> (the-as dma-packet v1-3) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet v1-3) vif1) (new 'static 'vif-tag)) + (set! (-> s4-0 base) (&+ (the-as pointer v1-3) 16)) + ) + (dma-bucket-insert-tag + (-> *display* frames (-> *display* on-screen) frame bucket-group) + 68 + s5-0 + (the-as (pointer dma-tag) a3-1) + ) + ) + ) + ) + arg0 + ) + +;; definition for function debug-menu-item-var-render +;; ERROR: function was not converted to expressions. Cannot decompile. + +;; definition for function debug-menu-item-render +(defun + debug-menu-item-render + ((arg0 debug-menu-item) (arg1 int) (arg2 int) (arg3 int) (arg4 symbol)) + (when (> (-> arg0 refresh-delay) 0) + (set! (-> arg0 refresh-ctr) (+ (-> arg0 refresh-ctr) -1)) + (when (<= (-> arg0 refresh-ctr) 0) + (set! (-> arg0 refresh-ctr) (-> arg0 refresh-delay)) + (debug-menu-item-send-msg arg0 3) + ) + ) + (cond + ((= (-> arg0 type) debug-menu-item-submenu) + (debug-menu-item-submenu-render + (the-as debug-menu-item-submenu arg0) + arg1 + arg2 + arg3 + arg4 + ) + ) + ((= (-> arg0 type) debug-menu-item-function) + (debug-menu-item-function-render + (the-as debug-menu-item-function arg0) + arg1 + arg2 + arg3 + arg4 + ) + ) + ((= (-> arg0 type) debug-menu-item-flag) + (debug-menu-item-flag-render + (the-as debug-menu-item-flag arg0) + arg1 + arg2 + arg3 + arg4 + ) + ) + ((= (-> arg0 type) debug-menu-item-var) + (debug-menu-item-var-render + (the-as debug-menu-item-var arg0) + arg1 + arg2 + arg3 + arg4 + ) + ) + (else + (format 0 "ERROR: Found unknown item type!~%") + ) + ) + arg0 + ) + +;; definition for function debug-menu-render +;; Used lq/sq +(defun + debug-menu-render + ((arg0 debug-menu) (arg1 int) (arg2 int) (arg3 int) (arg4 int)) + (local-vars (sv-16 dma-buffer) (sv-32 pointer)) + (let ((v1-0 0)) + (let* ((a0-1 (-> arg0 items)) + (a1-1 (car a0-1)) + ) + (while (not (null? a0-1)) + (if (= a1-1 arg3) + (begin + (goto cfg-7) + ) + ) + (+! v1-0 1) + (set! a0-1 (cdr a0-1)) + (set! a1-1 (car a0-1)) + ) + ) + (label cfg-7) + (if (< 16 v1-0) + (set! arg2 (- arg2 (* (+ v1-0 -16) 8))) + ) + ) + (let* ((s0-0 (-> *display* frames (-> *display* on-screen) frame debug-buf)) + (s1-0 (-> s0-0 base)) + ) + (draw-sprite2d-xy + s0-0 + arg1 + arg2 + (-> arg0 pix-width) + (-> arg0 pix-height) + (new 'static 'rgba :a #x40) + ) + (let ((a3-2 (-> s0-0 base))) + (let ((v1-7 (the-as object (-> s0-0 base)))) + (set! + (-> (the-as dma-packet v1-7) dma) + (new 'static 'dma-tag :id (dma-tag-id next)) + ) + (set! (-> (the-as dma-packet v1-7) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet v1-7) vif1) (new 'static 'vif-tag)) + (set! (-> s0-0 base) (&+ (the-as pointer v1-7) 16)) + ) + (dma-bucket-insert-tag + (-> *display* frames (-> *display* on-screen) frame bucket-group) + 68 + s1-0 + (the-as (pointer dma-tag) a3-2) + ) + ) + ) + (let* ((s3-1 (+ arg1 3)) + (s2-1 (+ arg2 3)) + (s1-1 (-> arg0 items)) + (s0-1 (car s1-1)) + ) + (while (not (null? s1-1)) + (when (= s0-1 arg3) + (set! (-> arg0 context font color) (if (nonzero? arg4) + 13 + 12 + ) + ) + (let ((v1-16 (-> arg0 context font)) + (a1-5 s3-1) + (a0-18 s2-1) + ) + (set! (-> v1-16 origin x) (the float a1-5)) + (set! (-> v1-16 origin y) (the float a0-18)) + ) + (set! sv-16 (-> *display* frames (-> *display* on-screen) frame debug-buf)) + (set! sv-32 (-> sv-16 base)) + (draw-string ">" sv-16 (-> arg0 context font)) + (let ((a3-3 (-> sv-16 base))) + (let ((v1-26 (the-as object (-> sv-16 base)))) + (set! + (-> (the-as dma-packet v1-26) dma) + (new 'static 'dma-tag :id (dma-tag-id next)) + ) + (set! (-> (the-as dma-packet v1-26) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet v1-26) vif1) (new 'static 'vif-tag)) + (set! (-> sv-16 base) (&+ (the-as pointer v1-26) 16)) + ) + (dma-bucket-insert-tag + (-> *display* frames (-> *display* on-screen) frame bucket-group) + 68 + sv-32 + (the-as (pointer dma-tag) a3-3) + ) + ) + ) + (debug-menu-item-render + (the-as debug-menu-item s0-1) + (+ s3-1 12) + s2-1 + arg4 + (= s0-1 arg3) + ) + (+! s2-1 8) + (set! s1-1 (cdr s1-1)) + (set! s0-1 (car s1-1)) + ) + ) + arg0 + ) + +;; definition for function debug-menu-context-render +(defun debug-menu-context-render ((arg0 debug-menu-context)) + (let ((s4-0 6)) + (dotimes (s5-0 (-> arg0 sel-length)) + (let ((s3-0 (-> arg0 sel-menu s5-0))) + (let ((a3-0 (-> s3-0 selected-item))) + (debug-menu-render + s3-0 + s4-0 + 28 + (the-as int a3-0) + (+ (- -1 s5-0) (-> arg0 sel-length)) + ) + ) + (set! s4-0 (+ (+ s4-0 3) (-> s3-0 pix-width))) + ) + ) + ) + arg0 + ) + +;; definition for function debug-menu-context-select-next-or-prev-item +(defun + debug-menu-context-select-next-or-prev-item + ((arg0 debug-menu-context) (arg1 int)) + (local-vars (v1-6 object)) + (let ((s5-0 (-> arg0 sel-menu (+ (-> arg0 sel-length) -1)))) + (let ((a2-0 (-> s5-0 selected-item)) + (a0-1 '()) + (v1-4 '()) + ) + (let ((a3-0 (-> s5-0 items))) + (while (not (null? a3-0)) + (if (= (car a3-0) a2-0) + (begin + (set! v1-4 a3-0) + (goto cfg-7) + ) + ) + (set! a0-1 a3-0) + (set! a3-0 (cdr a3-0)) + ) + ) + (label cfg-7) + (if (null? v1-4) + (begin + (format 0 "ERROR: Couldn't find selected item in menu.~%") + (set! arg0 arg0) + (goto cfg-19) + ) + ) + (cond + ((>= arg1 0) + (if (null? (cdr v1-4)) + (set! v1-6 (car (-> s5-0 items))) + (set! v1-6 (car (cdr v1-4))) + ) + ) + (else + (if (null? a0-1) + (set! v1-6 (car (last (-> s5-0 items)))) + (set! v1-6 (car a0-1)) + ) + ) + ) + ) + (set! (-> s5-0 selected-item) (the-as debug-menu-item v1-6)) + ) + (label cfg-19) + arg0 + ) + +;; definition for function debug-menu-context-select-new-item +(defun debug-menu-context-select-new-item ((arg0 debug-menu-context) (arg1 int)) + (let* ((a2-0 (-> arg0 sel-menu (+ (-> arg0 sel-length) -1))) + (a1-1 (-> a2-0 selected-item)) + (a0-1 0) + (v1-4 -1) + ) + (let ((a2-1 (-> a2-0 items))) + (while (not (null? a2-1)) + (if (= (car a2-1) a1-1) + (set! v1-4 a0-1) + ) + (set! a2-1 (cdr a2-1)) + (+! a0-1 1) + ) + ) + (if (= v1-4 -1) + (begin + (format 0 "ERROR: Couldn't find selected item in menu.~%") + (set! arg0 arg0) + (goto cfg-25) + ) + ) + (cond + ((>= arg1 0) + (cond + ((= v1-4 (+ a0-1 -1)) + (set! arg1 1) + ) + ((>= (+ v1-4 arg1) a0-1) + (set! arg1 (+ (- -1 v1-4) a0-1)) + ) + ) + (dotimes (s4-0 arg1) + (debug-menu-context-select-next-or-prev-item arg0 1) + ) + ) + (else + (cond + ((zero? v1-4) + (set! arg1 -1) + ) + ((< (+ v1-4 arg1) 0) + (set! arg1 (- v1-4)) + ) + ) + (dotimes (s4-1 (- arg1)) + (debug-menu-context-select-next-or-prev-item arg0 -1) + ) + ) + ) + ) + (label cfg-25) + arg0 + ) + +;; definition for function debug-menu-context-open-submenu +(defun + debug-menu-context-open-submenu + ((arg0 debug-menu-context) (arg1 debug-menu)) + (let ((v1-0 (-> arg0 sel-length))) + (when (>= v1-0 8) + (format 0 "ERROR: Trying to exceed maximum menu depth!") + (return arg1) + ) + (when (null? (-> arg1 items)) + (format 0 "ERROR: Submenu has no items!") + (return arg1) + ) + (set! (-> arg0 sel-menu v1-0) arg1) + (if (not (-> arg1 selected-item)) + (set! (-> arg1 selected-item) (the-as debug-menu-item (-> arg1 items car))) + ) + (set! (-> arg0 sel-length) (+ v1-0 1)) + ) + (debug-menu-context-send-msg arg0 1 3) + ) + +;; definition for function debug-menu-context-close-submenu +(defun debug-menu-context-close-submenu ((arg0 debug-menu-context)) + (debug-menu-context-send-msg arg0 2 3) + (if (< 1 (-> arg0 sel-length)) + (set! (-> arg0 sel-length) (+ (-> arg0 sel-length) -1)) + ) + arg0 + ) + +;; definition for function debug-menu-item-submenu-msg +(defun debug-menu-item-submenu-msg ((arg0 debug-menu-item-submenu) (arg1 int)) + (when (= arg1 4) + (let ((a0-1 (-> arg0 parent context))) + (debug-menu-context-open-submenu a0-1 (-> arg0 submenu)) + ) + ) + arg0 + ) + +;; definition for function debug-menu-item-function-msg +(defun + debug-menu-item-function-msg + ((arg0 debug-menu-item-function) (arg1 symbol)) + (cond + ((= arg1 4) + (cond + ((-> arg0 activate-func) + (if ((-> arg0 activate-func) (-> arg0 id)) + (set! (-> arg0 hilite-timer) 6) + (set! (-> arg0 hilite-timer) -6) + ) + ) + (else + (set! (-> arg0 hilite-timer) -6) + ) + ) + ) + ((= arg1 2) + (set! (-> arg0 hilite-timer) 0) + 0 + ) + ) + arg0 + ) + +;; definition for function debug-menu-item-flag-msg +(defun debug-menu-item-flag-msg ((arg0 debug-menu-item-flag) (arg1 int)) + (cond + ((= arg1 4) + (if (-> arg0 activate-func) + (set! (-> arg0 is-on) ((-> arg0 activate-func) (-> arg0 id) 4)) + ) + (let ((a0-2 (-> arg0 parent context))) + (debug-menu-context-send-msg a0-2 3 2) + ) + ) + ((or (= arg1 3) (= arg1 1)) + (if (-> arg0 activate-func) + (set! (-> arg0 is-on) ((-> arg0 activate-func) (-> arg0 id) 3)) + ) + (set! (-> arg0 refresh-ctr) (-> arg0 refresh-delay)) + ) + ) + arg0 + ) + +;; definition for function debug-menu-item-var-joypad-handler +(defun debug-menu-item-var-joypad-handler ((arg0 debug-menu-item-var)) + (cond + ((zero? (logand (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons x))) + (let ((a0-1 (-> arg0 parent context))) + (debug-menu-context-release-joypad a0-1) + ) + (set! (-> arg0 grabbed-joypad-p) #f) + (when + (nonzero? + (logand (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons circle)) + ) + (cond + ((-> arg0 float-p) + (if (-> arg0 factivate-func) + (set! + (-> arg0 fval) + ((the-as (function int int float float float) (-> arg0 factivate-func)) + (-> arg0 id) + 4 + (-> arg0 fundo-val) + (-> arg0 fval) + ) + ) + ) + ) + (else + (if (-> arg0 factivate-func) + (set! + (-> arg0 fval) + (the-as + float + ((the-as (function int int int int int) (-> arg0 factivate-func)) + (-> arg0 id) + 4 + (the-as int (-> arg0 fundo-val)) + (the-as int (-> arg0 fval)) + ) + ) + ) + ) + ) + ) + (debug-menu-item-var-update-display-str arg0) + ) + (let ((a0-5 (-> arg0 parent context))) + (debug-menu-context-send-msg a0-5 3 2) + ) + ) + ((or + (nonzero? + (logand (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons right)) + ) + (nonzero? + (logand (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons left)) + ) + (nonzero? + (logand (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons down)) + ) + (nonzero? (logand (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons up))) + ) + (let ((v1-39 (cond + ((nonzero? + (logand + (-> *cpad-list* cpads 0 button0-abs 0) + (pad-buttons right) + ) + ) + 10 + ) + ((nonzero? + (logand + (-> *cpad-list* cpads 0 button0-abs 0) + (pad-buttons up) + ) + ) + 1 + ) + ((nonzero? + (logand + (-> *cpad-list* cpads 0 button0-abs 0) + (pad-buttons down) + ) + ) + -1 + ) + (else + -10 + ) + ) + ) + ) + (when (!= v1-39 (-> arg0 inc-dir)) + (set! (-> arg0 inc-dir) v1-39) + (set! (-> arg0 inc-delay) 15) + (set! (-> arg0 inc-delay-ctr) 0) + (set! (-> arg0 step-delay-ctr) 30) + (set! (-> arg0 fstep) (-> arg0 fstart-inc)) + (set! (-> arg0 fstep) (-> arg0 fstart-inc)) + ) + ) + (cond + ((<= (-> arg0 inc-delay-ctr) 0) + (if (> (-> arg0 inc-delay) 0) + (set! (-> arg0 inc-delay) (+ (-> arg0 inc-delay) -1)) + ) + (when (zero? (-> arg0 inc-delay)) + (cond + ((<= (-> arg0 step-delay-ctr) 0) + (set! (-> arg0 step-delay-ctr) 30) + (cond + ((-> arg0 float-p) + (if (< (-> arg0 fstep) 10000000.0) + (set! (-> arg0 fstep) (* 2.0 (-> arg0 fstep))) + ) + ) + (else + (if (< (the-as int (-> arg0 fstep)) #x989680) + (set! + (-> arg0 fstep) + (the-as float (* (the-as int (-> arg0 fstep)) 2)) + ) + ) + ) + ) + ) + (else + (set! (-> arg0 step-delay-ctr) (+ (-> arg0 step-delay-ctr) -1)) + ) + ) + ) + (set! (-> arg0 inc-delay-ctr) (-> arg0 inc-delay)) + (cond + ((-> arg0 float-p) + (when (-> arg0 factivate-func) + (let + ((f0-8 + (+ (-> arg0 fval) (* (the float (-> arg0 inc-dir)) (-> arg0 fstep))) + ) + ) + (if (-> arg0 range-p) + (set! + f0-8 + (fmin (fmax f0-8 (-> arg0 frange-min)) (-> arg0 frange-max)) + ) + ) + (set! + (-> arg0 fval) + ((the-as + (function int int float float float) + (-> arg0 factivate-func) + ) + (-> arg0 id) + 4 + f0-8 + (-> arg0 fval) + ) + ) + ) + ) + ) + (else + (when (-> arg0 factivate-func) + (let + ((a2-4 + (+ + (the-as int (-> arg0 fval)) + (* (-> arg0 inc-dir) (the-as int (-> arg0 fstep))) + ) + ) + ) + (if (-> arg0 range-p) + (set! + a2-4 + (min + (max a2-4 (the-as int (-> arg0 frange-min))) + (the-as int (-> arg0 frange-max)) + ) + ) + ) + (set! + (-> arg0 fval) + (the-as + float + ((the-as (function int int int int int) (-> arg0 factivate-func)) + (-> arg0 id) + 4 + a2-4 + (the-as int (-> arg0 fval)) + ) + ) + ) + ) + ) + ) + ) + (debug-menu-item-var-update-display-str arg0) + (let ((a0-20 (-> arg0 parent context))) + (debug-menu-context-send-msg a0-20 3 3) + ) + ) + (else + (set! (-> arg0 inc-delay-ctr) (+ (-> arg0 inc-delay-ctr) -1)) + ) + ) + ) + (else + (set! (-> arg0 inc-dir) 0) + 0 + ) + ) + arg0 + ) + +;; definition for function debug-menu-item-var-msg +(defun debug-menu-item-var-msg ((arg0 debug-menu-item-var) (arg1 int)) + (cond + ((= arg1 2) + (when (-> arg0 grabbed-joypad-p) + (let ((a0-1 (-> arg0 parent context))) + (debug-menu-context-release-joypad a0-1) + ) + (set! (-> arg0 grabbed-joypad-p) #f) + ) + ) + ((= arg1 4) + (when (not (-> arg0 grabbed-joypad-p)) + (let ((a0-2 (-> arg0 parent context))) + (when + (debug-menu-context-grab-joypad + a0-2 + arg0 + debug-menu-item-var-joypad-handler + ) + (set! (-> arg0 grabbed-joypad-p) #t) + (set! (-> arg0 fundo-val) (-> arg0 fval)) + (set! (-> arg0 fundo-val) (-> arg0 fval)) + (set! (-> arg0 inc-dir) 0) + 0 + ) + ) + ) + ) + ((or (= arg1 3) (= arg1 1)) + (cond + ((-> arg0 float-p) + (if (-> arg0 factivate-func) + (set! + (-> arg0 fval) + ((the-as (function int int float float float) (-> arg0 factivate-func)) + (-> arg0 id) + 3 + (-> arg0 fval) + (-> arg0 fval) + ) + ) + ) + ) + (else + (if (-> arg0 factivate-func) + (set! + (-> arg0 fval) + (the-as + float + ((the-as (function int int int int int) (-> arg0 factivate-func)) + (-> arg0 id) + 3 + (the-as int (-> arg0 fval)) + (the-as int (-> arg0 fval)) + ) + ) + ) + ) + ) + ) + (debug-menu-item-var-update-display-str arg0) + (set! (-> arg0 refresh-ctr) (-> arg0 refresh-delay)) + ) + ) + arg0 + ) + +;; definition for function debug-menu-item-send-msg +(defun debug-menu-item-send-msg ((arg0 debug-menu-item) (arg1 int)) + (cond + ((= (-> arg0 type) debug-menu-item-submenu) + (debug-menu-item-submenu-msg (the-as debug-menu-item-submenu arg0) arg1) + ) + ((= (-> arg0 type) debug-menu-item-function) + (debug-menu-item-function-msg + (the-as debug-menu-item-function arg0) + (the-as symbol arg1) + ) + ) + ((= (-> arg0 type) debug-menu-item-flag) + (debug-menu-item-flag-msg (the-as debug-menu-item-flag arg0) arg1) + ) + ((= (-> arg0 type) debug-menu-item-var) + (debug-menu-item-var-msg (the-as debug-menu-item-var arg0) arg1) + ) + (else + (format 0 "ERROR: Found unknown item type!~%") + ) + ) + arg0 + ) + +;; definition for function debug-menu-send-msg +(defun debug-menu-send-msg ((arg0 debug-menu) (arg1 int) (arg2 symbol)) + (let* ((s3-0 (-> arg0 items)) + (s2-0 (car s3-0)) + ) + (while (not (null? s3-0)) + (debug-menu-item-send-msg (the-as debug-menu-item s2-0) arg1) + (if + (and + arg2 + (= (-> (the-as debug-menu-item s2-0) type) debug-menu-item-submenu) + ) + (debug-menu-send-msg + (-> (the-as debug-menu-item-submenu s2-0) submenu) + arg1 + #t + ) + ) + (set! s3-0 (cdr s3-0)) + (set! s2-0 (car s3-0)) + ) + ) + arg0 + ) + +;; definition for function debug-menu-context-send-msg +(defun + debug-menu-context-send-msg + ((arg0 debug-menu-context) (arg1 int) (arg2 int)) + (cond + ((= arg2 1) + (debug-menu-send-msg (-> arg0 root-menu) arg1 #t) + ) + ((= arg2 2) + (when (-> arg0 is-active) + (dotimes (s4-0 (-> arg0 sel-length)) + (let ((a0-2 (-> arg0 sel-menu s4-0))) + (debug-menu-send-msg a0-2 arg1 #f) + ) + ) + ) + ) + ((= arg2 3) + (when (-> arg0 is-active) + (if (nonzero? (-> arg0 sel-length)) + (debug-menu-send-msg + (-> arg0 sel-menu (+ (-> arg0 sel-length) -1)) + arg1 + #f + ) + ) + ) + ) + ((zero? arg2) + (cond + ((= arg1 1) + (when (not (-> arg0 is-active)) + (set! (-> arg0 is-active) #t) + (debug-menu-context-send-msg arg0 1 2) + ) + ) + ((= arg1 2) + (when (-> arg0 is-active) + (debug-menu-context-send-msg arg0 2 2) + (set! (-> arg0 is-active) #f) + ) + ) + ) + ) + ) + arg0 + ) + +;; definition for function debug-menu-context-activate-selection +(defun debug-menu-context-activate-selection ((arg0 debug-menu-context)) + (let ((a0-1 (-> arg0 sel-menu (+ (-> arg0 sel-length) -1) selected-item))) + (debug-menu-item-send-msg a0-1 4) + ) + arg0 + ) + +;; definition for function debug-menus-default-joypad-func +(defun debug-menus-default-joypad-func ((arg0 debug-menu-context)) + (cond + ((nonzero? + (logand (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons square)) + ) + (cond + ((< 1 (-> arg0 sel-length)) + (debug-menu-context-close-submenu arg0) + ) + (else + ) + ) + ) + ((nonzero? (logand (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons x))) + (debug-menu-context-activate-selection arg0) + ) + ((nonzero? (logand (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons up))) + (debug-menu-context-select-new-item arg0 -1) + ) + ((nonzero? + (logand (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons down)) + ) + (debug-menu-context-select-new-item arg0 1) + ) + ((nonzero? + (logand (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons left)) + ) + (debug-menu-context-select-new-item arg0 -5) + ) + ((nonzero? + (logand (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons right)) + ) + (debug-menu-context-select-new-item arg0 5) + ) + ) + arg0 + ) + +;; definition for function debug-menus-active +(defun debug-menus-active ((arg0 debug-menu-context)) + (when (not (-> arg0 is-hidden)) + (if (-> arg0 joypad-func) + ((-> arg0 joypad-func) (-> arg0 joypad-item)) + (debug-menus-default-joypad-func arg0) + ) + (debug-menu-context-render arg0) + ) + arg0 + ) + +;; definition for function debug-menus-handler +(defun debug-menus-handler ((arg0 debug-menu-context)) + (if (-> arg0 is-active) + (debug-menus-active arg0) + ) + arg0 + ) + +;; failed to figure out what this is: +0 + +) diff --git a/test/decompiler/reference/engine/draw/drawable-ambient-h_REF.gc b/test/decompiler/reference/engine/draw/drawable-ambient-h_REF.gc index 9267d28cbe..becf8f5023 100644 --- a/test/decompiler/reference/engine/draw/drawable-ambient-h_REF.gc +++ b/test/decompiler/reference/engine/draw/drawable-ambient-h_REF.gc @@ -74,7 +74,7 @@ :flag-assert #x10004000a8 (:methods (dummy-14 () none 14) - (dummy-15 () none 15) + (dummy-15 (_type_) symbol 15) ) ) diff --git a/test/decompiler/reference/engine/game/game-info-h_REF.gc b/test/decompiler/reference/engine/game/game-info-h_REF.gc index 211a31eec3..126cf834a7 100644 --- a/test/decompiler/reference/engine/game/game-info-h_REF.gc +++ b/test/decompiler/reference/engine/game/game-info-h_REF.gc @@ -161,50 +161,50 @@ ;; definition of type game-info (deftype game-info (basic) - ((mode symbol :offset-assert 4) - (save-name basic :offset-assert 8) - (life float :offset-assert 12) - (life-max float :offset-assert 16) - (money float :offset-assert 20) - (money-total float :offset-assert 24) - (money-per-level uint8 32 :offset-assert 28) - (deaths-per-level uint8 32 :offset-assert 60) - (buzzer-total float :offset-assert 92) - (fuel float :offset-assert 96) - (perm-list entity-perm-array :offset-assert 100) - (task-perm-list entity-perm-array :offset-assert 104) - (current-continue continue-point :offset-assert 108) - (text-ids-seen bit-array :offset-assert 112) - (level-opened uint8 32 :offset-assert 116) - (hint-control (array level-hint-control) :offset-assert 148) - (task-hint-control array :offset-assert 152) - (total-deaths int32 :offset-assert 156) - (continue-deaths int32 :offset-assert 160) - (fuel-cell-deaths int32 :offset-assert 164) - (game-start-time uint64 :offset-assert 168) - (continue-time uint64 :offset-assert 176) - (death-time uint64 :offset-assert 184) - (hit-time uint64 :offset-assert 192) - (fuel-cell-pickup-time uint64 :offset-assert 200) - (fuel-cell-time (array uint64) :offset-assert 208) - (enter-level-time (array uint64) :offset-assert 212) - (in-level-time (array uint64) :offset-assert 216) - (blackout-time uint64 :offset-assert 224) - (letterbox-time uint64 :offset-assert 232) - (hint-play-time uint64 :offset-assert 240) - (display-text-time uint64 :offset-assert 248) - (display-text-handle uint64 :offset-assert 256) - (death-movie-tick int32 :offset-assert 264) - (want-auto-save symbol :offset-assert 268) - (auto-save-proc handle :offset-assert 272) - (auto-save-status uint32 :offset-assert 280) - (auto-save-card int32 :offset-assert 284) - (auto-save-which int32 :offset-assert 288) - (pov-camera-handle uint64 :offset-assert 296) - (other-camera-handle uint64 :offset-assert 304) - (death-pos vector-array :offset-assert 312) - (dummy basic :offset-assert 316) - (auto-save-count int32 :offset-assert 320) + ((mode symbol :offset-assert 4) + (save-name basic :offset-assert 8) + (life float :offset-assert 12) + (life-max float :offset-assert 16) + (money float :offset-assert 20) + (money-total float :offset-assert 24) + (money-per-level uint8 32 :offset-assert 28) + (deaths-per-level uint8 32 :offset-assert 60) + (buzzer-total float :offset-assert 92) + (fuel float :offset-assert 96) + (perm-list entity-perm-array :offset-assert 100) + (task-perm-list entity-perm-array :offset-assert 104) + (current-continue continue-point :offset-assert 108) + (text-ids-seen bit-array :offset-assert 112) + (level-opened uint8 32 :offset-assert 116) + (hint-control (array level-hint-control) :offset-assert 148) + (task-hint-control (array task-hint-control-group) :offset-assert 152) + (total-deaths int32 :offset-assert 156) + (continue-deaths int32 :offset-assert 160) + (fuel-cell-deaths int32 :offset-assert 164) + (game-start-time uint64 :offset-assert 168) + (continue-time uint64 :offset-assert 176) + (death-time uint64 :offset-assert 184) + (hit-time uint64 :offset-assert 192) + (fuel-cell-pickup-time uint64 :offset-assert 200) + (fuel-cell-time (array uint64) :offset-assert 208) + (enter-level-time (array uint64) :offset-assert 212) + (in-level-time (array uint64) :offset-assert 216) + (blackout-time uint64 :offset-assert 224) + (letterbox-time uint64 :offset-assert 232) + (hint-play-time uint64 :offset-assert 240) + (display-text-time uint64 :offset-assert 248) + (display-text-handle uint64 :offset-assert 256) + (death-movie-tick int32 :offset-assert 264) + (want-auto-save symbol :offset-assert 268) + (auto-save-proc handle :offset-assert 272) + (auto-save-status uint32 :offset-assert 280) + (auto-save-card int32 :offset-assert 284) + (auto-save-which int32 :offset-assert 288) + (pov-camera-handle uint64 :offset-assert 296) + (other-camera-handle uint64 :offset-assert 304) + (death-pos vector-array :offset-assert 312) + (dummy basic :offset-assert 316) + (auto-save-count int32 :offset-assert 320) ) :method-count-assert 29 :size-assert #x144 diff --git a/test/decompiler/reference/engine/game/main-h_REF.gc b/test/decompiler/reference/engine/game/main-h_REF.gc index 249495aa12..9c3d6ef225 100644 --- a/test/decompiler/reference/engine/game/main-h_REF.gc +++ b/test/decompiler/reference/engine/game/main-h_REF.gc @@ -274,8 +274,8 @@ ;; definition for symbol *debug-hook*, type (function none) (define *debug-hook* nothing) -;; definition for symbol *menu-hook*, type (function none) -(define *menu-hook* nothing) +;; definition for symbol *menu-hook*, type (function debug-menu-context) +(define *menu-hook* (the-as (function debug-menu-context) nothing)) ;; definition for symbol *progress-hook*, type (function none) (define *progress-hook* nothing) diff --git a/test/decompiler/reference/engine/game/task/hint-control-h_REF.gc b/test/decompiler/reference/engine/game/task/hint-control-h_REF.gc index 1b3e0378d4..69a445aea8 100644 --- a/test/decompiler/reference/engine/game/task/hint-control-h_REF.gc +++ b/test/decompiler/reference/engine/game/task/hint-control-h_REF.gc @@ -59,7 +59,7 @@ ;; definition of type task-hint-control-group (deftype task-hint-control-group (structure) - ((tasks basic :offset-assert 0) + ((tasks (array task-hint-control) :offset-assert 0) ) :method-count-assert 9 :size-assert #x4 diff --git a/test/decompiler/reference/engine/game/task/hint-control_REF.gc b/test/decompiler/reference/engine/game/task/hint-control_REF.gc new file mode 100644 index 0000000000..1468616f11 --- /dev/null +++ b/test/decompiler/reference/engine/game/task/hint-control_REF.gc @@ -0,0 +1,525 @@ +;;-*-Lisp-*- +(in-package goal) + +;; failed to figure out what this is: +(set! + (-> *game-info* hint-control) + (the-as + (array level-hint-control) + (new + 'static + 'boxed-array + :type level-hint-control :length 25 :allocated-length 25 + (new 'static 'level-hint-control + :id #x917 + :num-attempts-before-playing 1 + :num-success-before-killing 3 + ) + (new 'static 'level-hint-control + :id #x90a + :num-attempts-before-playing 3 + :num-success-before-killing -1 + ) + (new 'static 'level-hint-control + :id #x284 + :num-attempts-before-playing 3 + :num-success-before-killing 3 + ) + (new 'static 'level-hint-control + :id #x285 + :num-attempts-before-playing 1 + :num-success-before-killing 1 + ) + (new 'static 'level-hint-control + :id #x251 + :num-attempts-before-playing 1 + :num-success-before-killing 1 + ) + (new 'static 'level-hint-control + :id #x2af + :num-attempts-before-playing 1 + :num-success-before-killing 1 + ) + (new 'static 'level-hint-control + :delay-before-playing #x384 + :id #x239 + :num-attempts-before-playing 1 + :num-success-before-killing 1 + ) + (new 'static 'level-hint-control + :delay-before-playing #x5dc + :id #x29d + :num-attempts-before-playing 1 + :num-success-before-killing -1 + ) + (new 'static 'level-hint-control + :delay-before-playing #x384 + :id #x25b + :num-attempts-before-playing 1 + :num-success-before-killing -1 + ) + (new 'static 'level-hint-control + :id #x2a4 + :num-attempts-before-playing 3 + :num-success-before-killing 1 + ) + (new 'static 'level-hint-control + :delay-before-playing #x384 + :id #x2aa + :num-attempts-before-playing 1 + :num-success-before-killing 1 + ) + (new 'static 'level-hint-control + :delay-before-playing #x5dc + :id #x33a + :num-attempts-before-playing 1 + :num-success-before-killing 1 + ) + (new 'static 'level-hint-control + :delay-before-playing #x1194 + :id #x34b + :num-attempts-before-playing 3 + :num-success-before-killing 2 + ) + (new 'static 'level-hint-control + :delay-before-playing #x4650 + :id #x34a + :num-attempts-before-playing 3 + :num-success-before-killing -1 + ) + (new 'static 'level-hint-control + :id #x34d + :num-attempts-before-playing 3 + :num-success-before-killing -1 + ) + (new 'static 'level-hint-control + :id #x345 + :num-attempts-before-playing 3 + :num-success-before-killing 2 + ) + (new 'static 'level-hint-control + :id #x352 + :num-attempts-before-playing 1 + :num-success-before-killing 1 + ) + (new 'static 'level-hint-control + :delay-before-playing #x2328 + :id #x347 + :num-attempts-before-playing 3 + :num-success-before-killing 1 + ) + (new 'static 'level-hint-control + :id #x34e + :num-attempts-before-playing 3 + :num-success-before-killing -1 + ) + (new 'static 'level-hint-control + :id #x444 + :num-attempts-before-playing 5 + :num-success-before-killing -1 + ) + (new 'static 'level-hint-control + :delay-before-playing #x384 + :id #x438 + :num-attempts-before-playing 1 + :num-success-before-killing -1 + ) + (new 'static 'level-hint-control + :id #x433 + :num-attempts-before-playing 4 + :num-success-before-killing -1 + ) + (new 'static 'level-hint-control + :id #x70d + :num-attempts-before-playing 1 + :num-success-before-killing 2 + ) + (new 'static 'level-hint-control + :delay-before-playing #x5dc + :id #x806 + :num-attempts-before-playing 1 + :num-success-before-killing 1 + ) + (new 'static 'level-hint-control + :delay-before-playing #x5dc + :id #x809 + :num-attempts-before-playing 1 + :num-success-before-killing 1 + ) + ) + ) + ) + +;; failed to figure out what this is: +(set! + (-> *game-info* task-hint-control) + (the-as + (array task-hint-control-group) + (new + 'static + 'boxed-array + :type task-hint-control-group :length 16 :allocated-length 16 + (new 'static 'task-hint-control-group + :tasks + (new + 'static + 'boxed-array + :type task-hint-control :length 3 :allocated-length 3 + (new 'static 'task-hint-control :task #x5c :delay #x2bf20) + (new 'static 'task-hint-control :task #x5d :delay #x57e40) + (new 'static 'task-hint-control :task #x5e :delay #x83d60) + ) + ) + (new 'static 'task-hint-control-group) + (new 'static 'task-hint-control-group + :tasks + (new + 'static + 'boxed-array + :type task-hint-control :length 3 :allocated-length 3 + (new 'static 'task-hint-control :task #x15 :delay #x41eb0) + (new 'static 'task-hint-control :task #x16 :delay #x83d60) + (new 'static 'task-hint-control :task #x13 :delay #xc5c10) + ) + ) + (new 'static 'task-hint-control-group + :tasks + (new + 'static + 'boxed-array + :type task-hint-control :length 2 :allocated-length 2 + (new 'static 'task-hint-control :task #x6 :delay #x57e40) + (new 'static 'task-hint-control :task #x8 :delay #xafc80) + ) + ) + (new 'static 'task-hint-control-group + :tasks + (new + 'static + 'boxed-array + :type task-hint-control :length 4 :allocated-length 4 + (new 'static 'task-hint-control :task #x18 :delay #x57e40) + (new 'static 'task-hint-control :task #x19 :delay #x83d60) + (new 'static 'task-hint-control :task #x1d :delay #xafc80) + (new 'static 'task-hint-control :task #x1e :delay #xdbba0) + ) + ) + (new 'static 'task-hint-control-group) + (new 'static 'task-hint-control-group) + (new 'static 'task-hint-control-group + :tasks + (new + 'static + 'boxed-array + :type task-hint-control :length 3 :allocated-length 3 + (new 'static 'task-hint-control :task #x33 :delay #x57e40) + (new 'static 'task-hint-control :task #x30 :delay #x83d60) + (new 'static 'task-hint-control :task #x2e :delay #xafc80) + ) + ) + (new 'static 'task-hint-control-group + :tasks + (new + 'static + 'boxed-array + :type task-hint-control :length 1 :allocated-length 1 + (new 'static 'task-hint-control :task #x26 :delay #xafc80) + ) + ) + (new 'static 'task-hint-control-group + :tasks + (new + 'static + 'boxed-array + :type task-hint-control :length 1 :allocated-length 1 + (new 'static 'task-hint-control :task #x38 :delay #xafc80) + ) + ) + (new 'static 'task-hint-control-group + :tasks + (new + 'static + 'boxed-array + :type task-hint-control :length 1 :allocated-length 1 + (new 'static 'task-hint-control :task #x6e :delay #x107ac0) + ) + ) + (new 'static 'task-hint-control-group + :tasks + (new + 'static + 'boxed-array + :type task-hint-control :length 1 :allocated-length 1 + (new 'static 'task-hint-control :task #x4a :delay #x107ac0) + ) + ) + (new 'static 'task-hint-control-group + :tasks + (new + 'static + 'boxed-array + :type task-hint-control :length 4 :allocated-length 4 + (new 'static 'task-hint-control :task #x42 :delay #x57e40) + (new 'static 'task-hint-control :task #x43 :delay #x83d60) + (new 'static 'task-hint-control :task #x3f :delay #xafc80) + (new 'static 'task-hint-control :task #x40 :delay #xdbba0) + ) + ) + (new 'static 'task-hint-control-group + :tasks + (new + 'static + 'boxed-array + :type task-hint-control :length 4 :allocated-length 4 + (new 'static 'task-hint-control :task #x50 :delay #x57e40) + (new 'static 'task-hint-control :task #x51 :delay #x83d60) + (new 'static 'task-hint-control :task #x52 :delay #xafc80) + (new 'static 'task-hint-control :task #x54 :delay #xdbba0) + ) + ) + (new 'static 'task-hint-control-group) + (new 'static 'task-hint-control-group) + ) + ) + ) + +;; definition for function find-hint-control-index +(defun find-hint-control-index ((arg0 level-hint-control)) + (let ((gp-0 -1)) + (let ((v1-2 (length (-> *game-info* hint-control)))) + (dotimes (a0-2 v1-2) + (when (= (-> *game-info* hint-control a0-2 id) arg0) + (set! gp-0 a0-2) + (set! a0-2 v1-2) + ) + ) + ) + gp-0 + ) + ) + +;; definition for function start-hint-timer +;; INFO: Return type mismatch int vs none. +(defun start-hint-timer ((arg0 level-hint-control)) + (let ((v1-0 (find-hint-control-index arg0))) + (when + (and + (>= v1-0 0) + (zero? (-> *game-info* hint-control v1-0 start-time)) + (!= (-> *game-info* hint-control v1-0 num-attempts-before-playing) 1) + ) + (set! + (-> *game-info* hint-control v1-0 start-time) + (-> *display* base-frame-counter) + ) + 0 + ) + ) + 0 + (none) + ) + +;; definition for function increment-success-for-hint +;; INFO: Return type mismatch int vs none. +(defun increment-success-for-hint ((arg0 level-hint-control)) + (let ((gp-0 (find-hint-control-index arg0))) + (when (>= gp-0 0) + (set! + (-> *game-info* hint-control gp-0 num-success) + (seekl (-> *game-info* hint-control gp-0 num-success) 127 1) + ) + 0 + ) + ) + 0 + (none) + ) + +;; definition for function can-hint-be-played? +;; WARN: disable def twice: 139. This may happen when a cond (no else) is nested inside of another conditional, but it should be rare. +(defun can-hint-be-played? ((arg0 int)) + (let ((v1-0 (not (str-is-playing?)))) + (if (and v1-0 (nonzero? arg0)) + (set! v1-0 (not (seen-text? *game-info* (the-as game-text-id arg0)))) + ) + (when v1-0 + (when *hint-semaphore* + (let ((v1-3 *hint-semaphore*)) + (set! v1-0 (dummy-15 (the-as level-hint (if v1-3 + (-> v1-3 0 self) + ) + ) + ) + ) + ) + 0 + ) + (when + (and + v1-0 + (< + (the-as + int + (- (-> *display* base-frame-counter) (-> *game-info* hint-play-time)) + ) + 30 + ) + ) + (set! v1-0 #f) + 0 + ) + (set! + v1-0 + (and + v1-0 + (not (-> *setting-control* current talking)) + (not (-> *setting-control* current spooling)) + (not (-> *setting-control* current hint)) + (not (-> *setting-control* current ambient)) + (>= + (the-as int (-> *display* base-frame-counter)) + (the-as int (-> *game-info* blackout-time)) + ) + ) + ) + 0 + ) + (cond + (v1-0 + (let ((v1-16 (find-hint-control-index (the-as level-hint-control arg0)))) + (cond + ((< v1-16 0) + #t + ) + (else + (let ((gp-1 (-> *game-info* hint-control v1-16)) + (a0-24 + (- + (-> *display* base-frame-counter) + (-> *game-info* hint-control v1-16 last-time-called) + ) + ) + (v1-21 #t) + ) + (if + (and + (= (-> gp-1 num-attempts-before-playing) 1) + (< (the-as int a0-24) 30) + ) + (set! (-> gp-1 start-time) (+ (-> gp-1 start-time) a0-24)) + ) + (cond + ((and + (!= (-> gp-1 num-attempts-before-playing) 1) + (nonzero? (-> gp-1 last-time-called)) + (< + (the-as + int + (- (-> *display* base-frame-counter) (-> gp-1 last-time-called)) + ) + 150 + ) + ) + (set! (-> gp-1 last-time-called) (-> *display* base-frame-counter)) + #f + ) + (else + (set! (-> gp-1 last-time-called) (-> *display* base-frame-counter)) + (when (nonzero? (-> gp-1 delay-before-playing)) + (if + (< + (the-as int (-> gp-1 start-time)) + (the-as int (-> gp-1 delay-before-playing)) + ) + (set! v1-21 #f) + ) + 0 + ) + (cond + (v1-21 + (set! (-> gp-1 num-attempts) (seekl (-> gp-1 num-attempts) 127 1)) + (and + (>= (-> gp-1 num-attempts) (-> gp-1 num-attempts-before-playing)) + (or + (= (-> gp-1 num-success-before-killing) -1) + (< (-> gp-1 num-success) (-> gp-1 num-success-before-killing)) + ) + ) + ) + (else + #f + ) + ) + ) + ) + ) + ) + ) + ) + ) + (else + #f + ) + ) + ) + ) + +;; definition for function reset-all-hint-controls +;; INFO: Return type mismatch int vs none. +(defun reset-all-hint-controls () + (let ((v1-2 (length (-> *game-info* hint-control)))) + (dotimes (a0-1 v1-2) + (let ((a1-2 (-> *game-info* hint-control a0-1))) + (set! (-> a1-2 start-time) (the-as uint 0)) + (set! (-> a1-2 last-time-called) (the-as uint 0)) + (set! (-> a1-2 num-attempts) 0) + (set! (-> a1-2 num-success) 0) + ) + 0 + ) + ) + 0 + (none) + ) + +;; definition for function update-task-hints +;; INFO: Return type mismatch int vs none. +(defun update-task-hints () + (when *target* + (let ((a0-0 (+ (-> *target* current-level info index) -1)) + (v1-7 (-> *game-info* task-hint-control)) + ) + (when (and (>= a0-0 0) (< a0-0 (-> *level-task-data-remap* length))) + (let ((a0-3 (-> *level-task-data-remap* a0-0))) + (when (< a0-3 (-> v1-7 length)) + (let ((gp-0 (-> v1-7 a0-3 tasks))) + (when (and (!= gp-0 0) (nonzero? (-> gp-0 length))) + (let ((s5-0 (-> *game-info* in-level-time a0-3))) + (dotimes (s4-0 (-> gp-0 length)) + (let + ((v1-17 (get-task-status (the-as game-task (-> gp-0 s4-0 task))))) + (when + (or + (= v1-17 (task-status need-hint)) + (= v1-17 (task-status unknown)) + ) + (if (< (-> gp-0 s4-0 delay) s5-0) + (close-specific-task! + (the-as game-task (-> gp-0 s4-0 task)) + (task-status need-hint) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + 0 + (none) + ) diff --git a/test/decompiler/reference/engine/gfx/shrub/shrubbery-h_REF.gc b/test/decompiler/reference/engine/gfx/shrub/shrubbery-h_REF.gc index bef1f48a54..9d2364d996 100644 --- a/test/decompiler/reference/engine/gfx/shrub/shrubbery-h_REF.gc +++ b/test/decompiler/reference/engine/gfx/shrub/shrubbery-h_REF.gc @@ -114,7 +114,7 @@ (format #t "~Twind-index: ~D~%" (-> obj wind-index)) (format #t "~Tflat-normal: #~%" (-> obj flat-normal)) (format #t "~Tflat-hwidth: ~f~%" (-> obj flat-normal w)) - (format #t "~Tcolor: ~D~%" (-> obj color)) + (format #t "~Tcolor: ~D~%" (-> obj unknown)) obj ) diff --git a/test/decompiler/reference/engine/gfx/tie/prototype-h_REF.gc b/test/decompiler/reference/engine/gfx/tie/prototype-h_REF.gc index fd8142e210..89554ea127 100644 --- a/test/decompiler/reference/engine/gfx/tie/prototype-h_REF.gc +++ b/test/decompiler/reference/engine/gfx/tie/prototype-h_REF.gc @@ -245,6 +245,7 @@ ;; definition of type instance (deftype instance (drawable) ((bucket-index uint16 :offset 6) + (unknown uint32 :offset 8) (origin matrix4h :inline :offset-assert 32) (wind-index uint16 :offset 62) ) diff --git a/test/decompiler/reference/engine/gfx/tie/tie-h_REF.gc b/test/decompiler/reference/engine/gfx/tie/tie-h_REF.gc index 2470680d9f..0a2c01c763 100644 --- a/test/decompiler/reference/engine/gfx/tie/tie-h_REF.gc +++ b/test/decompiler/reference/engine/gfx/tie/tie-h_REF.gc @@ -67,7 +67,7 @@ (format #t "~Tbucket-index: ~D~%" (-> obj bucket-index)) (format #t "~Torigin: #~%" (-> obj origin)) (format #t "~Twind-index: ~D~%" (-> obj wind-index)) - (format #t "~Tcolor-indices: #x~X~%" (-> obj color-indices)) + (format #t "~Tcolor-indices: #x~X~%" (-> obj unknown)) (format #t "~Tbucket-ptr: ~A~%" (-> obj bucket-ptr)) (format #t "~Tmax-scale: ~D~%" (-> obj max-scale)) (format #t "~Tflags: ~D~%" (-> obj flags)) diff --git a/test/offline/offline_test_main.cpp b/test/offline/offline_test_main.cpp index aa1bc45a32..5d46e7c7d3 100644 --- a/test/offline/offline_test_main.cpp +++ b/test/offline/offline_test_main.cpp @@ -46,35 +46,24 @@ const std::unordered_set g_functions_expected_to_reject = { "(method 9 bounding-box)", // handwritten asm loop "(method 14 bounding-box)", // handwritten asm loop // trig - "exp", - "atan0", - "sincos!", - "sincos-rad!", + "exp", "atan0", "sincos!", "sincos-rad!", // matrix "(method 9 matrix)", // handwritten asm loop - "matrix-axis-sin-cos!", - "matrix-axis-sin-cos-vu!", + "matrix-axis-sin-cos!", "matrix-axis-sin-cos-vu!", // dma-h "dma-count-until-done", // dma asm loop - "dma-sync-with-count", - "dma-send-no-scratch", - "dma-sync-fast", + "dma-sync-with-count", "dma-send-no-scratch", "dma-sync-fast", // dma - "symlink2", - "symlink3", + "symlink2", "symlink3", "dma-sync-hang", // handwritten asm "vector=", // asm branching // display "vblank-handler", // asm - "vif1-handler", - "vif1-handler-debug", + "vif1-handler", "vif1-handler-debug", // stats-h - "(method 11 perf-stat)", - "(method 12 perf-stat)", + "(method 11 perf-stat)", "(method 12 perf-stat)", // ripple - asm - "ripple-execute-init", - "ripple-create-wave-table", - "ripple-apply-wave-table", + "ripple-execute-init", "ripple-create-wave-table", "ripple-apply-wave-table", "ripple-matrix-scale", // ripple - calls an asm function "ripple-execute", @@ -90,6 +79,8 @@ const std::unordered_set g_functions_expected_to_reject = { // actor-link-h "(method 21 actor-link-info)", // BUG: sc cfg / cfg-ir bug "(method 20 actor-link-info)", + + "debug-menu-item-var-render" // asm }; const std::unordered_set g_functions_to_skip_compiling = { diff --git a/third-party/googletest b/third-party/googletest index 7153098229..adeef19294 160000 --- a/third-party/googletest +++ b/third-party/googletest @@ -1 +1 @@ -Subproject commit 7153098229e88295f9655ff1d3b0e2fa9eada5f8 +Subproject commit adeef192947fbc0f68fa14a6c494c8df32177508