Skip to content

Commit

Permalink
[decomp] cleanup default-menu, fix dangerous IOP bug, autoconvert i…
Browse files Browse the repository at this point in the history
…nts in pairs to/from bintegers (#997)

* fix a couple macros in ref tests

* `default-menu` cleanup

* add `find-instance-by-name` func

* improve debugger slightly hopefully

* fix IOP PLAY buffer overrun bug

* fix `default-menu` more

* automatically convert ints in static pairs to/from bintegers

* fix test

* clang

* fix a few more lambdas

* update refs

* add custom menu cuz cool

* oopsie! also make `default-level` and `halfpipe` go away

* add camera teleport menu

* update types in debug menu
  • Loading branch information
ManDude authored Dec 9, 2021
1 parent dbc266c commit 59a1202
Show file tree
Hide file tree
Showing 62 changed files with 8,976 additions and 14,976 deletions.
151 changes: 85 additions & 66 deletions decompiler/config/all-types.gc
Original file line number Diff line number Diff line change
Expand Up @@ -6046,7 +6046,7 @@
(define-extern mt8-block-table (array int32))
(define-extern mt4-block-table (array int32))
(define-extern *shader-list* pair) ;; unknown type
(define-extern *edit-shader* int) ;; unknown type
(define-extern *edit-shader* texture-id)


;; ----------------------
Expand Down Expand Up @@ -14539,9 +14539,14 @@
;; Containing DGOs - ['GAME', 'ENGINE']
;; Version - 3

(defenum external-cam-option
:bitfield #t
(allow-z 0)
)

;; - Symbols

(define-extern *external-cam-options* int)
(define-extern *external-cam-options* external-cam-option)
(define-extern *external-cam-mode* symbol)
(define-extern *camera-look-through-other* int)
(define-extern *camera-other-fov* bfloat)
Expand Down Expand Up @@ -20177,25 +20182,25 @@
)

(deftype debug-menu-item-function (debug-menu-item)
((activate-func (function int object) :offset-assert 24)
((activate-func (function object object) :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 int object)) _type_ 0))
(new (symbol type string object (function object object)) _type_ 0))
)

(deftype debug-menu-item-flag (debug-menu-item)
((activate-func (function int debug-menu-msg object) :offset-assert 24) ;; func is kinda a guess
((activate-func (function object debug-menu-msg object) :offset-assert 24)
(is-on object :offset-assert 28)
)
:method-count-assert 9
:size-assert #x20
:flag-assert #x900000020
(:methods
(new (symbol type string int (function int debug-menu-msg object)) _type_ 0))
(new (symbol type string object (function object debug-menu-msg object)) _type_ 0))
)


Expand Down Expand Up @@ -20272,7 +20277,7 @@
(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-append-item (function debug-menu debug-menu-node debug-menu-node))
(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 debug-menu-msg int int int) int symbol int int symbol debug-menu-item-var))
Expand Down Expand Up @@ -20304,10 +20309,10 @@
(define-extern error-sphere (function drawable-error string none))
(define-extern draw-instance-info (function string none)) ;; only passed *stdcon*
(define-extern find-instance-by-name (function string prototype-bucket))
(define-extern prototype-bucket-type (function instance type))
(define-extern prototype-bucket-type (function prototype-bucket type))
(define-extern guard-band-cull (function vector symbol)) ;; vf deps - 20-23
(define-extern find-instance-by-index function)
(define-extern prototype-bucket-recalc-fields (function instance instance))
(define-extern prototype-bucket-recalc-fields (function prototype-bucket prototype-bucket))
(define-extern dma-add-process-drawable-hud (function process-drawable draw-control symbol dma-buffer none))
(define-extern foreground-engine-execute (function engine display-frame int int none))
(define-extern main-debug-hook (function none))
Expand Down Expand Up @@ -21831,8 +21836,19 @@
:flag-assert #x900000044
)

(defenum anim-tester-flags
:bitfield #t
:type int32
(fanimt0)
(fanimt1)
(fanimt2)
(fanimt3)
(fanimt4)
(fanimt5)
)

(deftype anim-tester (process-drawable)
((flags int32 :offset-assert 176)
((flags anim-tester-flags :offset-assert 176)
(obj-list glst-list :inline :offset-assert 180)
(current-obj string :offset-assert 196)
(speed int32 :offset-assert 200)
Expand All @@ -21852,6 +21868,9 @@
:size-assert #x198
:heap-base #x130
:flag-assert #x1401300198
(:states
anim-tester-process
)
)

(deftype anim-test-obj (glst-named-node)
Expand Down Expand Up @@ -22030,67 +22049,67 @@

;; - Functions

(define-extern build-continue-menu (function debug-menu-context debug-menu-context)) ;; TODO - this is so simple...just iterating through a list of symbols...still confused though...
(define-extern build-continue-menu (function debug-menu game-info debug-menu-context))
(define-extern debug-menu-make-camera-menu (function debug-menu-context debug-menu-item-submenu))
(define-extern debug-menu-make-shader-menu (function debug-menu-context debug-menu-item-submenu))
(define-extern debug-menu-make-instance-menu (function debug-menu-context debug-menu-item-submenu))
(define-extern debug-menu-make-task-menu (function debug-menu-context debug-menu-item-submenu))
(define-extern dm-current-continue (function function int object)) ;; TODO - game-info::17
(define-extern dm-task-get-money (function int int symbol))
(define-extern dm-levitator-ready (function int int symbol))
(define-extern dm-lavabike-ready (function int int symbol))
(define-extern dm-give-all-cells (function int int symbol))
(define-extern debug-menu-make-task-unknown-menu (function debug-menu-context debug-menu-context debug-menu-item))
(define-extern debug-menu-make-task-need-hint-menu (function debug-menu-context debug-menu-context debug-menu-item))
(define-extern debug-menu-make-task-need-introduction-menu (function debug-menu-context debug-menu-context debug-menu-item))
(define-extern debug-menu-make-task-need-reminder-a-menu (function debug-menu-context debug-menu-context debug-menu-item))
(define-extern debug-menu-make-task-need-reminder-menu (function debug-menu-context debug-menu-context debug-menu-item))
(define-extern debug-menu-make-task-need-reward-speech-menu (function debug-menu-context debug-menu-context debug-menu-item))
(define-extern debug-menu-make-task-need-resolution-menu (function debug-menu-context debug-menu-context debug-menu-item))
(define-extern dm-give-cell (function int none))
(define-extern build-instance-list (function none)) ;; TODO - drawable types aren't complete
(define-extern dm-edit-instance-toggle-pick-func (function int int symbol))
(define-extern dm-boolean-toggle-pick-func (function (pointer symbol) int object)) ;; TODO
(define-extern dm-current-continue (function string debug-menu-msg symbol))
(define-extern dm-task-get-money (function int debug-menu-msg symbol))
(define-extern dm-levitator-ready (function int debug-menu-msg symbol))
(define-extern dm-lavabike-ready (function int debug-menu-msg symbol))
(define-extern dm-give-all-cells (function int debug-menu-msg symbol))
(define-extern debug-menu-make-task-unknown-menu (function debug-menu debug-menu-context none))
(define-extern debug-menu-make-task-need-hint-menu (function debug-menu debug-menu-context none))
(define-extern debug-menu-make-task-need-introduction-menu (function debug-menu debug-menu-context none))
(define-extern debug-menu-make-task-need-reminder-a-menu (function debug-menu debug-menu-context none))
(define-extern debug-menu-make-task-need-reminder-menu (function debug-menu debug-menu-context none))
(define-extern debug-menu-make-task-need-reward-speech-menu (function debug-menu debug-menu-context none))
(define-extern debug-menu-make-task-need-resolution-menu (function debug-menu debug-menu-context none))
(define-extern dm-give-cell (function game-task none))
(define-extern build-instance-list (function object none)) ;; TODO - drawable types aren't complete
(define-extern dm-edit-instance-toggle-pick-func (function int debug-menu-msg symbol))
(define-extern dm-boolean-toggle-pick-func (function (pointer symbol) debug-menu-msg symbol))
(define-extern build-shader-list (function object))
(define-extern all-texture-tweak-adjust (function texture-page-dir float object)) ;; TODO - texture related types
(define-extern debug-menu-make-camera-mode-menu (function int int object)) ;; TODO - depends on camera stuff yet merged
(define-extern dm-cam-externalize (function symbol int symbol))
(define-extern dm-cam-render-float (function int int float float float))
(define-extern dm-cam-settings-func (function int int symbol))
(define-extern dm-cam-settings-func-int (function int int debug-menu debug-menu debug-menu))
(define-extern all-texture-tweak-adjust (function texture-page-dir float none)) ;; TODO - texture related types
(define-extern debug-menu-make-camera-mode-menu (function debug-menu debug-menu none))
(define-extern dm-cam-externalize (function symbol debug-menu-msg symbol))
(define-extern dm-cam-render-float (function int debug-menu-msg float float float))
(define-extern dm-cam-settings-func (function int debug-menu-msg symbol))
(define-extern dm-cam-settings-func-int (function int debug-menu-msg int int int))
(define-extern debug-create-cam-restore (function none)) ;; TODO - level-group type isn't complete
(define-extern dm-cam-mode-func (function (state camera-slave) int object))
(define-extern dm-instance-pick-func (function string int basic))
(define-extern dm-enable-instance-func (function string int symbol))
(define-extern dm-shader-pick-func (function texture-id int object)) ;; TODO - more texture stuff...
(define-extern debug-menu-node<? (function debug-menu debug-menu symbol))
(define-extern dm-subdiv-float (function symbol int float float float))
(define-extern dm-subdiv-int (function function int object object object)) ;; TODO - dependant on anim-tester
(define-extern dm-setting-language (function function int symbol))
(define-extern dm-subdiv-draw-func (function int int symbol))
(define-extern dm-ocean-subdiv-draw-func (function int int symbol))
(define-extern dm-time-of-day-func (function int int symbol))
(define-extern dm-time-of-day-func2 (function (pointer symbol) int symbol)) ;; TODO
(define-extern dm-time-of-day-pick-func (function symbol int none)) ;; TODO - confirm time-of-day::time-of-day-setup
(define-extern dm-actor-marks-pick-func (function symbol int symbol))
(define-extern dm-compact-actor-pick-func (function int int object)) ;; TODO - what is *compact-actors*
(define-extern dm-actor-vis-pick-func (function symbol int symbol))
(define-extern dm-game-mode-pick-func (function symbol int symbol))
(define-extern dm-vu1-user-toggle-pick-func (function int int symbol))
(define-extern dm-vu1-user-set-pick-func (function int int symbol))
(define-extern dm-texture-user-toggle-pick-func (function int int symbol))
(define-extern dm-texture-user-set-pick-func (function int int symbol))
(define-extern dm-strip-lines-toggle-pick-func (function int int symbol))
(define-extern dm-strip-lines-set-pick-func (function int int symbol))
(define-extern dm-task-unknown (function int int symbol))
(define-extern dm-task-hint (function int int symbol))
(define-extern dm-task-introduction (function int int symbol))
(define-extern dm-task-reminder-a (function int int symbol))
(define-extern dm-task-reminder (function int int symbol))
(define-extern dm-task-reward-speech (function int int symbol))
(define-extern dm-task-resolution (function int int symbol))
(define-extern dm-anim-tester-flag-func (function int int object)) ;; TODO - *anim-tester*
(define-extern dm-anim-tester-func (function int none)) ;; TODO - *anim-tester*
(define-extern dm-cam-mode-func (function (state camera-slave) debug-menu-msg object))
(define-extern dm-instance-pick-func (function string debug-menu-msg basic))
(define-extern dm-enable-instance-func (function string debug-menu-msg symbol))
(define-extern dm-shader-pick-func (function texture-id debug-menu-msg symbol))
(define-extern debug-menu-node<? (function debug-menu-node debug-menu-node symbol))
(define-extern dm-subdiv-float (function symbol debug-menu-msg float float float))
(define-extern dm-subdiv-int (function symbol debug-menu-msg int int int))
(define-extern dm-setting-language (function int debug-menu-msg symbol))
(define-extern dm-subdiv-draw-func (function int debug-menu-msg symbol))
(define-extern dm-ocean-subdiv-draw-func (function int debug-menu-msg symbol))
(define-extern dm-time-of-day-func (function int debug-menu-msg symbol))
(define-extern dm-time-of-day-func2 (function (pointer symbol) debug-menu-msg symbol)) ;; TODO
(define-extern dm-time-of-day-pick-func (function symbol debug-menu-msg none)) ;; TODO - confirm time-of-day::time-of-day-setup
(define-extern dm-actor-marks-pick-func (function symbol debug-menu-msg symbol))
(define-extern dm-compact-actor-pick-func (function symbol debug-menu-msg symbol))
(define-extern dm-actor-vis-pick-func (function symbol debug-menu-msg symbol))
(define-extern dm-game-mode-pick-func (function symbol debug-menu-msg symbol))
(define-extern dm-vu1-user-toggle-pick-func (function vu1-renderer-mask debug-menu-msg symbol))
(define-extern dm-vu1-user-set-pick-func (function vu1-renderer-mask debug-menu-msg symbol))
(define-extern dm-texture-user-toggle-pick-func (function int debug-menu-msg symbol))
(define-extern dm-texture-user-set-pick-func (function int debug-menu-msg symbol))
(define-extern dm-strip-lines-toggle-pick-func (function int debug-menu-msg symbol))
(define-extern dm-strip-lines-set-pick-func (function int debug-menu-msg symbol))
(define-extern dm-task-unknown (function int debug-menu-msg symbol))
(define-extern dm-task-hint (function int debug-menu-msg symbol))
(define-extern dm-task-introduction (function int debug-menu-msg symbol))
(define-extern dm-task-reminder-a (function int debug-menu-msg symbol))
(define-extern dm-task-reminder (function int debug-menu-msg symbol))
(define-extern dm-task-reward-speech (function int debug-menu-msg symbol))
(define-extern dm-task-resolution (function int debug-menu-msg symbol))
(define-extern dm-anim-tester-flag-func (function int debug-menu-msg symbol))
(define-extern dm-anim-tester-func (function int debug-menu-msg none)) ;; TODO - *anim-tester*
(define-extern debug-menu-context-make-default-menus (function debug-menu-context debug-menu-context))
(define-extern popup-menu-context-make-default-menus (function debug-menu-context debug-menu-context))

Expand All @@ -22102,7 +22121,7 @@
(define-extern *enable-instance-tie-menu* debug-menu)
(define-extern *shader-pick-menu* debug-menu)
(define-extern cam-robotboss (state camera-slave))
(define-extern *dm-cam-mode-interpolation* debug-menu)
(define-extern *dm-cam-mode-interpolation* int)


;; ----------------------
Expand Down
Loading

0 comments on commit 59a1202

Please sign in to comment.