Skip to content

Commit

Permalink
[decomp] prepare for some files, fill in some types (#617)
Browse files Browse the repository at this point in the history
* [mips disasm] don't multiply `vcallms` parameter by 8

* [decomp] prep some game loop files
  • Loading branch information
ManDude authored Jun 21, 2021
1 parent 87961bd commit a123f02
Show file tree
Hide file tree
Showing 13 changed files with 335 additions and 348 deletions.
2 changes: 1 addition & 1 deletion decompiler/Disasm/InstructionDecode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1104,7 +1104,7 @@ Instruction decode_instruction(LinkedWord& word, LinkedObjectFile& file, int seg
atom.set_vu_q();
break;
case DecodeType::VCALLMS_TARGET:
atom.set_imm(value * 8);
atom.set_imm(value);
break;
case DecodeType::BRANCH_TARGET:
atom.set_label(file.get_label_id_for(seg_id, (word_id + value + 1) * 4));
Expand Down
274 changes: 122 additions & 152 deletions decompiler/config/all-types.gc

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,9 @@

"hud":[
[15, "(function basic int basic event-message-block object)"]
]
],

"main":[
[4, "(function none)"]
]
}
4 changes: 4 additions & 0 deletions decompiler/config/jak1_ntsc_black_label/label_types.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -587,5 +587,9 @@

"entity-table": [
["L8", "(array entity-info)", true]
],

"main": [
["L230", "_lambda_", true]
]
}
8 changes: 8 additions & 0 deletions decompiler/config/jak1_ntsc_black_label/type_casts.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,15 @@
"drawable-frag-count": [
[[14, 20], "s5", "drawable-group"]
],

"generic-init-buffers": [
[[39, 44], "v1", "dma-packet"]
],

"main-cheats": [
[1221, "t9", "(function cpu-thread function none)"]
],
"on": [
[33, "t9", "(function cpu-thread function none)"]
]
}
29 changes: 15 additions & 14 deletions goal_src/engine/game/game-info-h.gc
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,9 @@
)
)

(declare-type entity-perm-array basic)
(deftype game-info (basic)
((mode basic :offset-assert 4)
((mode symbol :offset-assert 4)
(save-name basic :offset-assert 8)
(life float :offset-assert 12)
(life-max float :offset-assert 16)
Expand All @@ -110,13 +111,13 @@
(deaths-per-level uint8 32 :offset-assert 60)
(buzzer-total float :offset-assert 92)
(fuel float :offset-assert 96)
(perm-list basic :offset-assert 100)
(task-perm-list basic :offset-assert 104)
(current-continue basic :offset-assert 108)
(text-ids-seen basic :offset-assert 112)
(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 basic :offset-assert 148)
(task-hint-control basic :offset-assert 152)
(hint-control array :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)
Expand All @@ -125,23 +126,23 @@
(death-time uint64 :offset-assert 184)
(hit-time uint64 :offset-assert 192)
(fuel-cell-pickup-time uint64 :offset-assert 200)
(fuel-cell-time basic :offset-assert 208)
(enter-level-time basic :offset-assert 212)
(in-level-time basic :offset-assert 216)
(fuel-cell-time array :offset-assert 208)
(enter-level-time array :offset-assert 212)
(in-level-time array :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 basic :offset-assert 268)
(want-auto-save symbol :offset-assert 268)
(auto-save-proc uint64 :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 basic :offset-assert 312)
(death-pos vector-array :offset-assert 312)
(dummy basic :offset-assert 316)
(auto-save-count int32 :offset-assert 320)
)
Expand All @@ -150,15 +151,15 @@
:flag-assert #x1d00000144
;; field dummy is a basic loaded with a signed load
(:methods
(dummy-9 () none 9)
(dummy-9 (_type_ symbol symbol string) none 9)
(dummy-10 () none 10)
(dummy-11 () none 11)
(dummy-12 () none 12)
(dummy-13 () none 13)
(dummy-14 () none 14)
(dummy-15 () none 15)
(dummy-16 () none 16)
(dummy-17 () none 17)
(dummy-17 (_type_) none 17)
(dummy-18 () none 18)
(dummy-19 () none 19)
(dummy-20 () none 20)
Expand Down
79 changes: 41 additions & 38 deletions goal_src/engine/level/level-h.gc
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,19 @@
;; Per level information related to how to load the level.
;; These are stored in level-info.gc
(deftype level-load-info (basic)
((name-list basic 3 :offset-assert 4)
((name-list symbol 3 :offset-assert 4)
(index int32 :offset-assert 16) ;; the level number (starting with 1?)
(name basic :offset 4) ;; symbol with full name, like "misty"
(visname basic :offset 8) ;; symbol with vis file name, like "misty-vis"
(nickname basic :offset 12) ;; 3 letter name for DGO, like "mis"
(name symbol :offset 4) ;; symbol with full name, like "misty"
(visname symbol :offset 8) ;; symbol with vis file name, like "misty-vis"
(nickname symbol :offset 12) ;; 3 letter name for DGO, like "mis"
(packages pair :offset-assert 20) ;; list of symbols, usually empty or the level name
(sound-banks pair :offset-assert 24) ;; require sound bank files (list of symbols)
(music-bank basic :offset-assert 28) ;; name of level music
(music-bank symbol :offset-assert 28) ;; name of level music
(ambient-sounds pair :offset-assert 32) ;; always empty list.
(mood basic :offset-assert 36) ;; mood object name
(mood-func basic :offset-assert 40) ;; mood update function name
(ocean basic :offset-assert 44) ;; ocean map object
(sky basic :offset-assert 48) ;; boolean to enable sky
(mood symbol :offset-assert 36) ;; mood object name
(mood-func symbol :offset-assert 40) ;; mood update function name
(ocean symbol :offset-assert 44) ;; ocean map object
(sky symbol :offset-assert 48) ;; boolean to enable sky
(sun-fade float :offset-assert 52) ;; sun/sky setting
(continues pair :offset-assert 56) ;; list of checkpoints
(tasks pair :offset-assert 60) ;; list of boxed integers for tasks
Expand All @@ -65,7 +65,7 @@
(run-packages pair :offset-assert 100) ;; possibly unused?
(prev-level basic :offset-assert 104)
(next-level basic :offset-assert 108)
(wait-for-load basic :offset-assert 112)
(wait-for-load symbol :offset-assert 112)
)
:method-count-assert 9
:size-assert #x74
Expand All @@ -84,19 +84,22 @@
)

(declare-type bsp-header basic)
(declare-type art-group basic)
(declare-type engine basic)
(declare-type entity-links-array basic)
(declare-type entity-ambient-data-array basic)
(declare-type mood-context basic)
;; Per level-buffer info about the current loaded level.
(deftype level (basic)
((name basic :offset-assert 4)
(load-name basic :offset-assert 8)
(nickname basic :offset-assert 12)
((name symbol :offset-assert 4)
(load-name symbol :offset-assert 8)
(nickname symbol :offset-assert 12)
(index int32 :offset-assert 16)
(status basic :offset-assert 20)
(other basic :offset-assert 24)
(status symbol :offset-assert 20)
(other level :offset-assert 24)
(heap kheap :inline :offset-assert 32)
(bsp bsp-header :offset-assert 48)
(art-group art-group :offset-assert 52)
(info basic :offset-assert 56)
(art-group load-dir-art-group :offset-assert 52)
(info level-load-info :offset-assert 56)
(texture-page texture-page 9 :offset-assert 60)
(loaded-texture-page basic 16 :offset-assert 96)
(loaded-texture-page-count int32 :offset-assert 160)
Expand All @@ -105,21 +108,21 @@
; (foreground-sink-group-2 dma-foreground-sink-group :inline :offset-assert 240)
; (array-pad uint8 12)
(foreground-sink-group dma-foreground-sink-group 3 :inline :offset-assert 176) ;; inline basic
(foreground-draw-engine basic 3 :offset-assert 272)
(entity basic :offset-assert 284)
(ambient basic :offset-assert 288)
(foreground-draw-engine engine 3 :offset-assert 272)
(entity entity-links-array :offset-assert 284)
(ambient entity-ambient-data-array :offset-assert 288)
(closest-object float 9 :offset-assert 292)
(upload-size int32 9 :offset-assert 328)
(level-distance float :offset-assert 364) ; meters
(inside-sphere? basic :offset-assert 368)
(inside-boxes? basic :offset-assert 372)
(display? basic :offset-assert 376)
(meta-inside? basic :offset-assert 380)
(mood basic :offset-assert 384)
(mood-func basic :offset-assert 388)
(inside-sphere? symbol :offset-assert 368)
(inside-boxes? symbol :offset-assert 372)
(display? symbol :offset-assert 376)
(meta-inside? symbol :offset-assert 380)
(mood mood-context :offset-assert 384)
(mood-func function :offset-assert 388)
(vis-bits uint32 :offset-assert 392)
(all-visible? basic :offset-assert 396)
(force-all-visible? basic :offset-assert 400)
(all-visible? symbol :offset-assert 396)
(force-all-visible? symbol :offset-assert 400)
(linking basic :offset-assert 404)
(vis-info level-vis-info 8 :offset-assert 408)
(vis-self-index int32 :offset-assert 440)
Expand All @@ -130,7 +133,7 @@
(code-memory-start uint32 :offset-assert 2504)
(code-memory-end uint32 :offset-assert 2508)
(texture-mask uint32 9 :offset-assert 2512)
(force-inside? basic :offset-assert 2548)
(force-inside? symbol :offset-assert 2548)
(pad uint8 56)
)
:method-count-assert 29
Expand All @@ -151,7 +154,7 @@
(dummy-20 () none 20)
(dummy-21 () none 21)
(dummy-22 () none 22)
(dummy-23 () none 23)
(dummy-23 (_type_ symbol) none 23)
(dummy-24 () none 24)
(dummy-25 () none 25)
(dummy-26 () none 26)
Expand Down Expand Up @@ -192,17 +195,17 @@
:size-assert #x1ef4
:flag-assert #x1b00001ef4
(:methods
(dummy-9 () none 9)
(dummy-10 () none 10)
(dummy-11 () none 11)
(dummy-12 () none 12)
(dummy-9 (_type_ symbol) level 9)
(dummy-10 (_type_ symbol) symbol 10)
(dummy-11 (_type_ symbol symbol) _type_ 11)
(dummy-12 (_type_) none 12)
(dummy-13 () none 13)
(dummy-14 () none 14)
(dummy-15 () none 15)
(dummy-16 () none 16)
(dummy-17 () none 17)
(dummy-18 () none 18)
(dummy-19 () none 19)
(dummy-17 (_type_) none 17)
(dummy-18 (_type_ symbol) none 18)
(dummy-19 (_type_ pair) none 19)
(dummy-20 () none 20)
(dummy-21 () none 21)
(dummy-22 () none 22)
Expand Down
Loading

0 comments on commit a123f02

Please sign in to comment.