[decomp] prototype-h, a few enums and other random things (#422)

* [decompiler] fix missing error in asm output

* decomp prototype-h, cleanup pat-h and res-h, prep for fact-h & res

* fix types

* Update all-types.gc

* fix a methos in `res-h`
This commit is contained in:
ManDude
2021-05-07 00:00:30 +01:00
committed by GitHub
parent 233d887790
commit 812efd92ca
13 changed files with 547 additions and 387 deletions
+2 -1
View File
@@ -1670,8 +1670,9 @@ void build_initial_forms(Function& function) {
function.ir2.top_form = result;
} catch (std::runtime_error& e) {
function.warnings.general_warning(e.what());
lg::warn("Failed to build initial forms in {}: {}", function.guessed_name.to_string(),
e.what());
}
}
} // namespace decompiler
} // namespace decompiler
+176 -184
View File
@@ -8030,6 +8030,14 @@
:flag-assert #x900000018
)
;; game-info-h
(deftype actor-id (uint32)
()
:method-count-assert 9
:size-assert #x4
:flag-assert #x900000004
)
;; game-info-h
(deftype level-buffer-state (structure)
((name basic :offset-assert 0)
@@ -8197,85 +8205,54 @@
:flag-assert #x900000534
)
; ;; prototype-h
; (deftype prototype-bucket (basic)
; ((name basic :offset-assert 4)
; (flags uint32 :offset-assert 8)
; (in-level uint16 :offset-assert 12)
; (utextures uint16 :offset-assert 14)
; (geometry UNKNOWN 4 :offset-assert 16)
; (dists vector :inline :offset-assert 32)
; (rdists vector :inline :offset-assert 48)
; (next UNKNOWN 4 :offset-assert 64)
; (count UNKNOWN 4 :offset-assert 80)
; (near-plane meters :offset-assert 32)
; (near-stiff meters :offset-assert 36)
; (mid-plane meters :offset-assert 40)
; (far-plane meters :offset-assert 44)
; (rlength-near float :offset-assert 48)
; (rlength-stiff float :offset-assert 52)
; (rlength-mid float :offset-assert 56)
; (stiffness float :offset-assert 60)
; (next-clear uint128 :offset-assert 64)
; (count-clear uint64 :offset-assert 80)
; )
; :method-count-assert 9
; :size-assert #x58
; :flag-assert #x900000058
; )
;; prototype-h
(deftype prototype-bucket (basic)
((name basic :offset-assert 4)
(flags uint32 :offset-assert 8)
(in-level uint16 :offset-assert 12)
(utextures uint16 :offset-assert 14)
(geometry uint32 4 :offset-assert 16)
(dists vector :inline :offset-assert 32)
(rdists vector :inline :offset-assert 48)
(next uint32 4 :offset-assert 64)
(count uint16 4 :offset-assert 80)
(near-plane float :offset 32) ;; meters
(near-stiff float :offset 36) ;; meters
(mid-plane float :offset 40) ;; meters
(far-plane float :offset 44) ;; meters
(rlength-near float :offset 48)
(rlength-stiff float :offset 52)
(rlength-mid float :offset 56)
(stiffness float :offset 60)
(next-clear uint128 :offset 64)
(count-clear uint64 :offset 80)
)
:method-count-assert 9
:size-assert #x58
:flag-assert #x900000058
)
; ;; prototype-h
; (deftype prototype-bucket-shrub (prototype-bucket)
; ((name basic :offset-assert 4)
; (flags uint32 :offset-assert 8)
; (in-level uint16 :offset-assert 12)
; (utextures uint16 :offset-assert 14)
; (geometry UNKNOWN 4 :offset-assert 16)
; (dists vector :inline :offset-assert 32)
; (rdists vector :inline :offset-assert 48)
; (next UNKNOWN 4 :offset-assert 64)
; (count UNKNOWN 4 :offset-assert 80)
; (near-plane meters :offset-assert 32)
; (near-stiff meters :offset-assert 36)
; (mid-plane meters :offset-assert 40)
; (far-plane meters :offset-assert 44)
; (rlength-near float :offset-assert 48)
; (rlength-stiff float :offset-assert 52)
; (rlength-mid float :offset-assert 56)
; (stiffness float :offset-assert 60)
; (next-clear uint128 :offset-assert 64)
; (count-clear uint64 :offset-assert 80)
; (mod-count UNKNOWN 4 :offset-assert 88)
; (last UNKNOWN 4 :offset-assert 96)
; (last-clear uint128 :offset-assert 96)
; )
; :method-count-assert 9
; :size-assert #x70
; :flag-assert #x900000070
; )
;; prototype-h
(deftype prototype-bucket-shrub (prototype-bucket)
((mod-count uint16 4 :offset-assert 88)
(last uint32 4 :offset-assert 96)
(last-clear uint128 :offset 96)
)
:method-count-assert 9
:size-assert #x70
:flag-assert #x900000070
)
; ;; prototype-h
; (deftype prototype-inline-array-shrub (drawable)
; ((id int16 :offset-assert 4)
; (bsphere vector :inline :offset-assert 16)
; (length int16 :offset-assert 6)
; (data UNKNOWN 1 :offset-assert 36)
; )
; :method-count-assert 18
; :size-assert #x94
; :flag-assert #x1200000094
; (:methods
; (dummy-9 () 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)
; )
; )
;; prototype-h
(deftype prototype-inline-array-shrub (drawable)
((length int16 :offset 6)
(data prototype-bucket-shrub 1 :inline :offset 32)
(_pad uint32)
)
:method-count-assert 18
:size-assert #x94
:flag-assert #x1200000094
)
;; prototype-h
(deftype prototype-array-shrub-info (basic)
@@ -8287,46 +8264,27 @@
:flag-assert #x90000000c
)
; ;; prototype-h
; (deftype prototype-bucket-tie (prototype-bucket)
; ((name basic :offset-assert 4)
; (flags uint32 :offset-assert 8)
; (in-level uint16 :offset-assert 12)
; (utextures uint16 :offset-assert 14)
; (geometry UNKNOWN 4 :offset-assert 16)
; (dists vector :inline :offset-assert 32)
; (rdists vector :inline :offset-assert 48)
; (next UNKNOWN 4 :offset-assert 64)
; (count UNKNOWN 4 :offset-assert 80)
; (near-plane meters :offset-assert 32)
; (near-stiff meters :offset-assert 36)
; (mid-plane meters :offset-assert 40)
; (far-plane meters :offset-assert 44)
; (rlength-near float :offset-assert 48)
; (rlength-stiff float :offset-assert 52)
; (rlength-mid float :offset-assert 56)
; (stiffness float :offset-assert 60)
; (next-clear uint128 :offset-assert 64)
; (count-clear uint64 :offset-assert 80)
; (generic-count UNKNOWN 4 :offset-assert 88)
; (generic-next UNKNOWN 4 :offset-assert 96)
; (frag-count UNKNOWN 4 :offset-assert 112)
; (index-start UNKNOWN 4 :offset-assert 116)
; (base-qw UNKNOWN 4 :offset-assert 120)
; (envmap-rfade float :offset-assert 128)
; (envmap-fade-far float :offset-assert 132)
; (envmap-shader adgif-shader :offset-assert 136)
; (collide-frag basic :offset-assert 140)
; (tie-colors basic :offset-assert 144)
; (data UNKNOWN :dynamic :offset-assert 148)
; (color-index-qwc UNKNOWN :dynamic :offset-assert 148)
; (generic-next-clear uint128 :offset-assert 96)
; (generic-count-clear uint128 :offset-assert 80)
; )
; :method-count-assert 9
; :size-assert #x94
; :flag-assert #x900000094
; )
;; prototype-h
(deftype prototype-bucket-tie (prototype-bucket)
((generic-count uint16 4 :offset-assert 88)
(generic-next uint32 4 :offset-assert 96)
(frag-count uint8 4 :offset-assert 112)
(index-start uint8 4 :offset-assert 116)
(base-qw uint16 4 :offset-assert 120)
(envmap-rfade float :offset-assert 128)
(envmap-fade-far float :offset-assert 132)
(envmap-shader adgif-shader :offset-assert 136)
(collide-frag basic :offset-assert 140)
(tie-colors basic :offset-assert 144)
(data uint32 :dynamic :offset-assert 148)
(color-index-qwc uint32 :dynamic :offset-assert 148)
(generic-next-clear uint128 :offset 96)
(generic-count-clear uint128 :offset 80)
)
:method-count-assert 9
:size-assert #x94
:flag-assert #x900000094
)
;; prototype-h
(deftype prototype-array-tie (array)
@@ -8586,7 +8544,10 @@
;; res-h
(deftype res-tag (uint128)
()
((unk0 uint32 :offset 0 :size 32)
(unk1 uint16 :offset 32 :size 16)
(unk2 uint64 :offset 64 :size 64)
)
:flag-assert #x900000010
)
@@ -8597,53 +8558,30 @@
(data-top pointer :offset-assert 16)
(data-size int32 :offset-assert 20)
(extra basic :offset-assert 24)
(tag uint32 :offset-assert 28)
(tag (pointer res-tag) :offset-assert 28)
)
:method-count-assert 22
:size-assert #x20
:flag-assert #x1600000020
;; field extra is a basic loaded with a signed load
(:methods
(dummy-9 () 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-18 () none 18)
(dummy-19 () none 19)
(dummy-20 () none 20)
(dummy-21 () none 21)
(new (symbol type int int) _type_ 0)
(dummy-9 (_type_ symbol symbol int symbol (pointer res-tag) pointer) symbol 9)
(dummy-10 (_type_ symbol symbol int symbol symbol pointer) int 10)
(dummy-11 (_type_ symbol symbol int int symbol pointer) int 11)
(dummy-12 (_type_ symbol symbol int int symbol pointer) float 12)
(dummy-13 (_type_ int) pointer 13) ;; advance tag pointer
(dummy-14 (_type_ uint) pointer 14)
(dummy-15 (_type_) none 15)
(dummy-16 (_type_ int int int int) none 16)
(dummy-17 (_type_ int int) res-lump 17)
(dummy-18 (_type_ int int) none 18)
(dummy-19 (_type_ symbol symbol int) int 19)
(dummy-20 (_type_ int int) none 20)
(dummy-21 (_type_ int int int int int) none 21)
)
)
; ;; res
; (deftype res-lump (basic)
; ()
; :method-count-assert 22
; :size-assert #x20
; :flag-assert #x1600000020
; ;; too many basic blocks
; (:methods
; (dummy-9 () 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-18 () none 18)
; (dummy-19 () none 19)
; (dummy-20 () none 20)
; (dummy-21 () none 21)
; )
; )
;; dynamics-h
(deftype dynamics (basic)
((name basic :offset-assert 4)
@@ -8759,25 +8697,77 @@
(define-extern *pole-mods* surface) ;; unknown type
;; pat-h
(defenum pat-material
:type uint8
(stone)
(ice)
(quicksand)
(waterbottom)
(tar)
(sand)
(wood)
(grass)
(pcmetal)
(snow)
(deepsnow)
(hotcoals)
(lava)
(crwood)
(gravel)
(dirt)
(metal)
(straw)
(tube)
(swamp)
(stopproj)
(rotate)
(neutral)
)
(defenum pat-mode
:type uint8
(ground)
(wall)
(obstacle)
)
(defenum pat-event
:type uint8
(none)
(deadly)
(endlessfall)
(burn)
(deadlyup)
(burnup)
(melt)
)
(deftype pat-surface (uint32)
()
((skip uint8 :offset 0 :size 3)
(mode pat-mode :offset 3 :size 3)
(material pat-material :offset 6 :size 6)
(camera uint8 :offset 12 :size 2)
(event pat-event :offset 14 :size 6)
(noentity uint8 :offset 0 :size 1)
(nocamera uint8 :offset 1 :size 1)
(noedge uint8 :offset 2 :size 1)
(nolineofsight uint8 :offset 12 :size 1)
)
:method-count-assert 9
:size-assert #x4
:flag-assert #x900000004
)
(define-extern pat-event->string (function pat-surface string))
(define-extern pat-material->string (function pat-surface string))
;;(define-extern pat-surface object) ;; unknown type
;;(define-extern pat-mode-info object) ;; unknown type
(define-extern pat-mode->string (function pat-surface string))
(define-extern pat-event->string (function pat-surface string))
;; pat-h
(deftype pat-mode-info (structure)
((name basic :offset-assert 0)
((name string :offset-assert 0)
(wall-angle float :offset-assert 4)
(color uint32 :offset-assert 8)
(hilite-color uint32 :offset-assert 12)
(color rgba :offset-assert 8)
(hilite-color rgba :offset-assert 12)
)
:method-count-assert 9
:size-assert #x10
@@ -8807,12 +8797,24 @@
:flag-assert #x90000004c
)
(define-extern pickup-type->string (function int string))
(defenum pickup-type
(none)
(eco-yellow)
(eco-red)
(eco-blue)
(eco-green)
(money)
(fuel-cell)
(eco-pill)
(buzzer)
(eco-pill-random)
)
(define-extern pickup-type->string (function pickup-type string))
;; fact-h
(deftype fact-info (basic)
((process basic :offset-assert 4)
(pickup-type int32 :offset-assert 8)
((process process :offset-assert 4)
(pickup-type pickup-type :offset-assert 8)
(pickup-amount float :offset-assert 12)
(pickup-spawn-amount float :offset-assert 16)
(options uint64 :offset-assert 24)
@@ -8822,9 +8824,10 @@
:size-assert #x28
:flag-assert #xc00000028
(:methods
(new (symbol type process pickup-type float) _type_ 0)
(dummy-9 () none 9)
(dummy-10 () none 10)
(dummy-11 () none 11)
(dummy-11 (_type_) none 11)
)
)
@@ -8851,11 +8854,6 @@
:method-count-assert 12
:size-assert #x90
:flag-assert #xc00000090
(:methods
(dummy-9 () none 9)
(dummy-10 () none 10)
(dummy-11 () none 11)
)
)
;; fact-h
@@ -8871,11 +8869,6 @@
:method-count-assert 12
:size-assert #x44
:flag-assert #xc00000044
(:methods
(dummy-9 () none 9)
(dummy-10 () none 10)
(dummy-11 () none 11)
)
)
;; aligner-h
@@ -33867,13 +33860,12 @@
(define-extern game-info type)
;;(define-extern level-buffer-state object) ;; unknown type
;;(define-extern actor-id object) ;; unknown type
;;(define-extern *GAME-bank* object) ;; unknown type
(define-extern *GAME-bank* game-bank) ;; unknown type
;;(define-extern wind-work object) ;; unknown type
(define-extern wind-get-hashed-index (function vector int))
;;(define-extern *wind-scales* object) ;; unknown type
(define-extern *wind-scales* (array uint8)) ;; unknown type
;;(define-extern wind-vector object) ;; unknown type
(define-extern *wind-work* wind-work) ;; unknown type
(define-extern prototype-bucket-shrub type)
(define-extern prototype-bucket-tie type)
;;(define-extern instance object) ;; unknown type
;;(define-extern prototype-bucket object) ;; unknown type
@@ -33904,8 +33896,8 @@
;;(define-extern draw object) ;; unknown type
;;(define-extern *debug-engine* object) ;; unknown type
;;(define-extern res-tag object) ;; unknown type
;;(define-extern *res-key-string* object) ;; unknown type
;;(define-extern *res-static-buf* object) ;; unknown type
(define-extern *res-key-string* string) ;; unknown type
(define-extern *res-static-buf* pointer) ;; unknown type
(define-extern part-group-pointer? function)
(define-extern nav-mesh type)
(define-extern collide-mesh type)
@@ -33949,13 +33941,13 @@
;;(define-extern launch-jump object) ;; unknown type
;;(define-extern run object) ;; unknown type
;;(define-extern *pat-mode-info* object) ;; unknown type
(define-extern *pat-mode-info* (inline-array pat-mode-info)) ;; unknown type
;;(define-extern fact-info-target object) ;; unknown type
(define-extern fact-bank type)
(define-extern fact-info type)
;;(define-extern fact-info-enemy object) ;; unknown type
;;(define-extern *FACT-bank* object) ;; unknown type
(define-extern *FACT-bank* fact-bank) ;; unknown type
;;(define-extern cam-vert object) ;; unknown type
;;(define-extern idle-distance object) ;; unknown type
;;(define-extern options object) ;; unknown type
@@ -375,7 +375,10 @@
"pat-h": [["L1", "(inline-array pat-mode-info)", true, 4]],
"fact-h": [["L35", "_auto_", true]],
"fact-h": [
["L35", "_auto_", true],
["L36", "float", true]
],
"sync-info": [
["L78", "float", true],
@@ -138,6 +138,8 @@
"draw-sprite2d-xy": [[16, "draw-context"]],
"screen-gradient": [[16, "draw-context"]],
//"(method 0 fact-info)": [[16, "res-tag"]],
"(method 10 oscillating-vector)":[[16, "vector"]]
}
@@ -380,5 +380,13 @@
[148, "a0", "(pointer uint64)"],
[150, "a0", "(pointer gs-reg64)"],
[[154, 159], "v1", "dma-packet"]
],
// RES
"(method 13 res-lump)": [
[6, "a0", "res-tag"]
],
"(method 14 res-lump)": [
[2, "a0", "res-tag"]
]
}
+29 -23
View File
@@ -6,36 +6,42 @@
;; dgos: GAME, ENGINE
(deftype res-tag (uint128)
()
:flag-assert #x900000010
((unk0 uint32 :offset 0 :size 32)
(unk1 uint16 :offset 32 :size 16)
(unk2 uint64 :offset 64 :size 64)
)
:flag-assert #x900000010
)
(deftype res-lump (basic)
((length int32 :offset-assert 4)
(allocated-length int32 :offset-assert 8)
(data-base pointer :offset-assert 12)
(data-top pointer :offset-assert 16)
(data-size int32 :offset-assert 20)
(extra basic :offset-assert 24)
(tag uint32 :offset-assert 28)
((length int32 :offset-assert 4)
(allocated-length int32 :offset-assert 8)
(data-base pointer :offset-assert 12)
(data-top pointer :offset-assert 16)
(data-size int32 :offset-assert 20)
(extra basic :offset-assert 24)
(tag (pointer res-tag) :offset-assert 28)
)
:method-count-assert 22
:size-assert #x20
:flag-assert #x1600000020
;; field extra is a basic loaded with a signed load
;; field extra is a basic loaded with a signed load
(:methods
(dummy-9 () 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-18 () none 18)
(dummy-19 () none 19)
(dummy-20 () none 20)
(dummy-21 () none 21)
(new (symbol type int int) _type_ 0)
(dummy-9 (_type_ symbol symbol int symbol (pointer res-tag) pointer) symbol 9)
(dummy-10 (_type_ symbol symbol int symbol symbol pointer) int 10)
(dummy-11 (_type_ symbol symbol int int symbol pointer) int 11)
(dummy-12 (_type_ symbol symbol int int symbol pointer) float 12)
(dummy-13 (_type_ int) pointer 13) ;; advance tag pointer
(dummy-14 (_type_ uint) pointer 14)
(dummy-15 (_type_) none 15)
(dummy-16 (_type_ int int int int) none 16)
(dummy-17 (_type_ int int) res-lump 17)
(dummy-18 (_type_ int int) none 18)
(dummy-19 (_type_ symbol symbol int) int 19)
(dummy-20 (_type_ int int) none 20)
(dummy-21 (_type_ int int int int int) none 21)
)
)
(define *res-key-string* (new 'global 'string 64 (the-as string #f)))
+31 -29
View File
@@ -48,27 +48,38 @@
)
)
(defun pickup-type->string ((arg0 int))
(local-vars (v1-0 int))
(set! v1-0 arg0)
(cond
((= v1-0 9) "eco-pill-random")
((= v1-0 8) "buzzer")
((= v1-0 7) "eco-pill")
((= v1-0 6) "fuel-cell")
((= v1-0 5) "money")
((= v1-0 4) "eco-green")
((= v1-0 3) "eco-blue")
((= v1-0 2) "eco-red")
((= v1-0 1) "eco-yellow")
((zero? v1-0) "none")
(else "*unknown*")
)
(defenum pickup-type
(none)
(eco-yellow)
(eco-red)
(eco-blue)
(eco-green)
(money)
(fuel-cell)
(eco-pill)
(buzzer)
(eco-pill-random)
)
(defun pickup-type->string ((arg0 pickup-type))
(case arg0
((pickup-type eco-pill-random) "eco-pill-random")
((pickup-type buzzer) "buzzer")
((pickup-type eco-pill) "eco-pill")
((pickup-type fuel-cell) "fuel-cell")
((pickup-type money) "money")
((pickup-type eco-green) "eco-green")
((pickup-type eco-blue) "eco-blue")
((pickup-type eco-red) "eco-red")
((pickup-type eco-yellow) "eco-yellow")
((pickup-type none) "none")
(else "*unknown*")
)
)
(deftype fact-info (basic)
((process basic :offset-assert 4)
(pickup-type int32 :offset-assert 8)
((process process :offset-assert 4)
(pickup-type pickup-type :offset-assert 8)
(pickup-amount float :offset-assert 12)
(pickup-spawn-amount float :offset-assert 16)
(options uint64 :offset-assert 24)
@@ -78,9 +89,10 @@
:size-assert #x28
:flag-assert #xc00000028
(:methods
(new (symbol type process pickup-type float) _type_ 0)
(dummy-9 () none 9)
(dummy-10 () none 10)
(dummy-11 () none 11)
(dummy-11 (_type_) none 11)
)
)
@@ -106,11 +118,6 @@
:method-count-assert 12
:size-assert #x90
:flag-assert #xc00000090
(:methods
(dummy-9 () none 9)
(dummy-10 () none 10)
(dummy-11 () none 11)
)
)
(deftype fact-info-enemy (fact-info)
@@ -125,9 +132,4 @@
:method-count-assert 12
:size-assert #x44
:flag-assert #xc00000044
(:methods
(dummy-9 () none 9)
(dummy-10 () none 10)
(dummy-11 () none 11)
)
)
+56 -57
View File
@@ -77,19 +77,19 @@
)
(deftype continue-point (basic)
((name basic :offset-assert 4)
(level basic :offset-assert 8)
(flags uint32 :offset-assert 12)
(trans vector :inline :offset-assert 16)
(quat vector :inline :offset-assert 32)
(camera-trans vector :inline :offset-assert 48)
(camera-rot float 9 :offset-assert 64)
((name basic :offset-assert 4)
(level basic :offset-assert 8)
(flags uint32 :offset-assert 12)
(trans vector :inline :offset-assert 16)
(quat vector :inline :offset-assert 32)
(camera-trans vector :inline :offset-assert 48)
(camera-rot float 9 :offset-assert 64)
(load-commands pair :offset-assert 100)
(vis-nick basic :offset-assert 104)
(lev0 basic :offset-assert 108)
(disp0 basic :offset-assert 112)
(lev1 basic :offset-assert 116)
(disp1 basic :offset-assert 120)
(vis-nick basic :offset-assert 104)
(lev0 basic :offset-assert 108)
(disp0 basic :offset-assert 112)
(lev1 basic :offset-assert 116)
(disp1 basic :offset-assert 120)
)
:method-count-assert 10
:size-assert #x7c
@@ -100,50 +100,50 @@
)
(deftype game-info (basic)
((mode basic :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 basic :offset-assert 100)
(task-perm-list basic :offset-assert 104)
(current-continue basic :offset-assert 108)
(text-ids-seen basic :offset-assert 112)
(level-opened uint8 32 :offset-assert 116)
(hint-control basic :offset-assert 148)
(task-hint-control basic :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 basic :offset-assert 208)
(enter-level-time basic :offset-assert 212)
(in-level-time basic :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)
(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)
(dummy basic :offset-assert 316)
(auto-save-count int32 :offset-assert 320)
((mode basic :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 basic :offset-assert 100)
(task-perm-list basic :offset-assert 104)
(current-continue basic :offset-assert 108)
(text-ids-seen basic :offset-assert 112)
(level-opened uint8 32 :offset-assert 116)
(hint-control basic :offset-assert 148)
(task-hint-control basic :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 basic :offset-assert 208)
(enter-level-time basic :offset-assert 212)
(in-level-time basic :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)
(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)
(dummy basic :offset-assert 316)
(auto-save-count int32 :offset-assert 320)
)
:method-count-assert 29
:size-assert #x144
@@ -174,7 +174,6 @@
)
(define-extern *game-info* game-info)
(when (or (not *game-info*) (zero? *game-info*))
(let ((temp (new 'static 'game-info :mode 'debug :current-continue #f)))
(set! (-> temp fuel-cell-time) (new 'global 'boxed-array uint64 116))
+104
View File
@@ -5,3 +5,107 @@
;; name in dgo: prototype-h
;; dgos: GAME, ENGINE
(deftype prototype-bucket (basic)
((name basic :offset-assert 4)
(flags uint32 :offset-assert 8)
(in-level uint16 :offset-assert 12)
(utextures uint16 :offset-assert 14)
(geometry uint32 4 :offset-assert 16)
(dists vector :inline :offset-assert 32)
(rdists vector :inline :offset-assert 48)
(next uint32 4 :offset-assert 64)
(count uint16 4 :offset-assert 80)
(near-plane float :offset 32)
(near-stiff float :offset 36)
(mid-plane float :offset 40)
(far-plane float :offset 44)
(rlength-near float :offset 48)
(rlength-stiff float :offset 52)
(rlength-mid float :offset 56)
(stiffness float :offset 60)
(next-clear uint128 :offset 64)
(count-clear uint64 :offset 80)
)
:method-count-assert 9
:size-assert #x58
:flag-assert #x900000058
)
(deftype prototype-bucket-shrub (prototype-bucket)
((mod-count uint16 4 :offset-assert 88)
(last uint32 4 :offset-assert 96)
(last-clear uint128 :offset 96)
)
:method-count-assert 9
:size-assert #x70
:flag-assert #x900000070
)
(deftype prototype-inline-array-shrub (drawable)
((length int16 :offset 6)
(data prototype-bucket-shrub 1 :inline :offset 32)
(_pad uint32 :offset-assert 144)
)
:method-count-assert 18
:size-assert #x94
:flag-assert #x1200000094
)
(deftype prototype-array-shrub-info (basic)
((prototype-inline-array-shrub basic :offset-assert 4)
(wind-vectors uint32 :offset-assert 8)
)
:method-count-assert 9
:size-assert #xc
:flag-assert #x90000000c
)
(deftype prototype-bucket-tie (prototype-bucket)
((generic-count uint16 4 :offset-assert 88)
(generic-next uint32 4 :offset-assert 96)
(frag-count uint8 4 :offset-assert 112)
(index-start uint8 4 :offset-assert 116)
(base-qw uint16 4 :offset-assert 120)
(envmap-rfade float :offset-assert 128)
(envmap-fade-far float :offset-assert 132)
(envmap-shader adgif-shader :offset-assert 136)
(collide-frag basic :offset-assert 140)
(tie-colors basic :offset-assert 144)
(data uint32 :dynamic :offset-assert 148)
(color-index-qwc uint32 :dynamic :offset-assert 148)
(generic-next-clear uint128 :offset 96)
(generic-count-clear uint128 :offset 80)
)
:method-count-assert 9
:size-assert #x94
:flag-assert #x900000094
)
(deftype prototype-array-tie (array)
()
:method-count-assert 10
:size-assert #x10
:flag-assert #xa00000010
(:methods
(dummy-9 () none 9)
)
)
(deftype proxy-prototype-array-tie (basic)
((prototype-array-tie basic :offset-assert 4)
(wind-vectors uint32 :offset-assert 8)
)
:method-count-assert 9
:size-assert #xc
:flag-assert #x90000000c
)
(deftype instance (drawable)
((bucket-index uint16 :offset 6)
(origin matrix4h :inline :offset-assert 32)
(wind-index uint16 :offset 62)
)
:method-count-assert 18
:size-assert #x40
:flag-assert #x1200000040
)
+1 -1
View File
@@ -45,6 +45,6 @@
(the int (-> arg0 data 2))
(the-as int (-> *wind-work* wind-time))
)
63
#x3f
)
)
+123 -90
View File
@@ -5,120 +5,153 @@
;; name in dgo: pat-h
;; dgos: GAME, ENGINE
(defenum pat-material
:type uint8
(stone)
(ice)
(quicksand)
(waterbottom)
(tar)
(sand)
(wood)
(grass)
(pcmetal)
(snow)
(deepsnow)
(hotcoals)
(lava)
(crwood)
(gravel)
(dirt)
(metal)
(straw)
(tube)
(swamp)
(stopproj)
(rotate)
(neutral)
)
(defenum pat-mode
:type uint8
(ground)
(wall)
(obstacle)
)
(defenum pat-event
:type uint8
(none)
(deadly)
(endlessfall)
(burn)
(deadlyup)
(burnup)
(melt)
)
(deftype pat-surface (uint32)
()
((skip uint8 :offset 0 :size 3)
(mode pat-mode :offset 3 :size 3)
(material pat-material :offset 6 :size 6)
(camera uint8 :offset 12 :size 2)
(event pat-event :offset 14 :size 6)
(noentity uint8 :offset 0 :size 1)
(nocamera uint8 :offset 1 :size 1)
(noedge uint8 :offset 2 :size 1)
(nolineofsight uint8 :offset 12 :size 1)
)
:method-count-assert 9
:size-assert #x4
:flag-assert #x900000004
)
(defmethod inspect pat-surface ((obj pat-surface))
(format #t "[~8x] ~A~%" obj 'pat-surface)
(format #t "~Tskip: ~D~%" (shr (shl (the-as int obj) 61) 61))
(format #t "~Tmode: ~D~%" (shr (shl (the-as int obj) 58) 61))
(format #t "~Tmaterial: ~D~%" (shr (shl (the-as int obj) 52) 58))
(format #t "~Tcamera: ~D~%" (shr (shl (the-as int obj) 50) 62))
(format #t "~Tevent: ~D~%" (shr (shl (the-as int obj) 44) 58))
(format #t "~Tnoentity: ~D~%" (shr (shl (the-as int obj) 63) 63))
(format #t "~Tnocamera: ~D~%" (shr (shl (the-as int obj) 62) 63))
(format #t "~Tnoedge: ~D~%" (shr (shl (the-as int obj) 61) 63))
(format #t "~Tnolineofsight: ~D~%" (shr (shl (the-as int obj) 51) 63))
obj
)
(defun-debug pat-material->string ((arg0 pat-surface))
(local-vars (v1-1 int))
(set! v1-1 (shr (shl (the-as int arg0) 52) 58))
(cond
((= v1-1 22) "neutral")
((= v1-1 21) "rotate")
((= v1-1 20) "stopproj")
((= v1-1 19) "swamp")
((= v1-1 18) "tube")
((= v1-1 17) "straw")
((= v1-1 16) "metal")
((= v1-1 15) "dirt")
((= v1-1 14) "gravel")
((= v1-1 13) "crwood")
((= v1-1 12) "lava")
((= v1-1 11) "hotcoals")
((= v1-1 10) "deepsnow")
((= v1-1 9) "snow")
((= v1-1 8) "pcmetal")
((= v1-1 7) "grass")
((= v1-1 6) "wood")
((= v1-1 5) "sand")
((= v1-1 4) "tar")
((= v1-1 3) "waterbottom")
((= v1-1 2) "quicksand")
((= v1-1 1) "ice")
((zero? v1-1) "stone")
(defun-debug pat-material->string ((pat pat-surface))
(case (-> pat material)
((pat-material neutral) "neutral")
((pat-material rotate) "rotate")
((pat-material stopproj) "stopproj")
((pat-material swamp) "swamp")
((pat-material tube) "tube")
((pat-material straw) "straw")
((pat-material metal) "metal")
((pat-material dirt) "dirt")
((pat-material gravel) "gravel")
((pat-material crwood) "crwood")
((pat-material lava) "lava")
((pat-material hotcoals) "hotcoals")
((pat-material deepsnow) "deepsnow")
((pat-material snow) "snow")
((pat-material pcmetal) "pcmetal")
((pat-material grass) "grass")
((pat-material wood) "wood")
((pat-material sand) "sand")
((pat-material tar) "tar")
((pat-material waterbottom) "waterbottom")
((pat-material quicksand) "quicksand")
((pat-material ice) "ice")
((pat-material stone) "stone")
(else "*unknown*")
)
)
(defun-debug pat-mode->string ((arg0 pat-surface))
(local-vars (v1-1 int))
(set! v1-1 (shr (shl (the-as int arg0) 58) 61))
(cond
((= v1-1 2) "obstacle")
((= v1-1 1) "wall")
((zero? v1-1) "ground")
(defun-debug pat-mode->string ((pat pat-surface))
(case (-> pat mode)
((pat-mode obstacle) "obstacle")
((pat-mode wall) "wall")
((pat-mode ground) "ground")
(else "*unknown*")
)
)
(defun pat-event->string ((arg0 pat-surface))
(local-vars (v1-1 int))
(set! v1-1 (shr (shl (the-as int arg0) 44) 58))
(cond
((= v1-1 6) "melt")
((= v1-1 5) "burnup")
((= v1-1 4) "deadlyup")
((= v1-1 3) "burn")
((= v1-1 2) "endlessfall")
((= v1-1 1) "deadly")
((zero? v1-1) "none")
(defun-debug pat-event->string ((pat pat-surface))
(case (-> pat event)
((pat-event melt) "melt")
((pat-event burnup) "burnup")
((pat-event deadlyup) "deadlyup")
((pat-event burn) "burn")
((pat-event endlessfall) "endlessfall")
((pat-event deadly) "deadly")
((pat-event none) "none")
(else "*unknown*")
)
)
(deftype pat-mode-info (structure)
((name basic :offset-assert 0)
((name string :offset-assert 0)
(wall-angle float :offset-assert 4)
(color uint32 :offset-assert 8)
(hilite-color uint32 :offset-assert 12)
(color rgba :offset-assert 8)
(hilite-color rgba :offset-assert 12)
)
:method-count-assert 9
:size-assert #x10
:flag-assert #x900000010
)
(define *pat-mode-info*
(new 'static 'inline-array pat-mode-info 4
(new 'static 'pat-mode-info
:name "ground"
:wall-angle (the-as float #x3e4ccccd)
:color #x4000007f
:hilite-color #x800000ff
)
(new 'static 'pat-mode-info
:name "wall"
:wall-angle 2.000000
:color #x407f0000
:hilite-color #x80ff0000
)
(new 'static 'pat-mode-info
:name "obstacle"
:wall-angle (the-as float #x3f51eb85)
:color #x407f007f
:hilite-color #x80ff00ff
)
(new 'static 'pat-mode-info
:name "pole"
:wall-angle 2.000000
:color #x40007f7f
:hilite-color #x8000ffff
)
)
(define *pat-mode-info* (new 'static 'inline-array pat-mode-info 4
(new 'static 'pat-mode-info
:name "ground"
:wall-angle 0.2
:color (new 'static 'rgba :r #x7f :a #x40)
:hilite-color (new 'static 'rgba :r #xff :a #x80)
)
(new 'static 'pat-mode-info
:name "wall"
:wall-angle 2.0
:color (new 'static 'rgba :b #x7f :a #x40)
:hilite-color (new 'static 'rgba :b #xff :a #x80)
)
(new 'static 'pat-mode-info
:name "obstacle"
:wall-angle 0.82
:color (new 'static 'rgba :r #x7f :b #x7f :a #x40)
:hilite-color (new 'static 'rgba :r #xff :b #xff :a #x80)
)
(new 'static 'pat-mode-info
:name "pole"
:wall-angle 2.0
:color (new 'static 'rgba :r #x7f :g #x7f :a #x40)
:hilite-color (new 'static 'rgba :r #xff :g #xff :a #x80)
)
)
)
+10
View File
@@ -367,6 +367,16 @@
)
)
(defmacro case-no-let (switch &rest cases)
"Same as case, but switch is replaced inline in the conditions instead of being saved to a separate variable.
Only use this if you know what you're doing!"
`(cond ,@(apply
(lambda (x) `(,@(if (eq? (first x) 'else) `(else ,@(rest x)) `((= ,switch ,(first x)) ,@(rest x)))))
cases)
)
)
;;;;;;;;;;;;;;;;;;;
;; Math Macros
;;;;;;;;;;;;;;;;;;;
+1 -1
View File
@@ -39,7 +39,7 @@
;; distance from a symbol pointer to a (pointer string)
;; this relies on the memory layout of the symbol table
;; this must match SYM_INFO_OFFSET in goal_constants.h + offset of the str field in struct SymUpper.
(defconstant SYM_TO_STRING_OFFSET 65336)
(defconstant SYM_TO_STRING_OFFSET #xff38)
;; pointers larger than this are invalid by valid?
(defconstant END_OF_MEMORY #x8000000)