[decompiler] small fixes for methods and more reference tests (#419)

* clean up method stuff, fix a few small bugs, and add references for easy -h files

* more small fixes and reference tests
This commit is contained in:
water111
2021-05-06 00:42:49 -04:00
committed by GitHub
parent 0a6602e320
commit 21fefa0aaa
41 changed files with 3427 additions and 220 deletions
-11
View File
@@ -15,17 +15,6 @@
:size-assert #x20
:flag-assert #x1200000020
;; field distance is a float printed as hex?
(:methods
(dummy-9 () none 9)
(dummy-10 (_type_) int 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)
)
)
;; the types of these fields are a guess for now.
-11
View File
@@ -11,17 +11,6 @@
:method-count-assert 18
:size-assert #x20
:flag-assert #x1200000020
(:methods
(dummy-9 () none 9)
(dummy-10 (_type_) int 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)
)
)
+48 -31
View File
@@ -5,42 +5,58 @@
;; name in dgo: drawable-ambient-h
;; dgos: GAME, ENGINE
;;-*-Lisp-*-
(in-package goal)
;; definition of type drawable-ambient
(deftype drawable-ambient (drawable)
((ambient basic :offset 8)
((ambient basic :offset 8)
)
:method-count-assert 19
:size-assert #x20
:flag-assert #x1300000020
(:methods
(dummy-9 () none 9)
(dummy-10 (_type_) int 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)
)
)
;; definition for method 3 of type drawable-ambient
(defmethod inspect drawable-ambient ((obj drawable-ambient))
(format #t "[~8x] ~A~%" obj (-> obj type))
(format #t "~Tid: ~D~%" (-> obj id))
(format #t "~Tbsphere: ~`vector`P~%" (-> obj bsphere))
(format #t "~Tambient: ~A~%" (-> obj ambient))
obj
)
;; definition of type drawable-tree-ambient
(deftype drawable-tree-ambient (drawable-tree)
()
:flag-assert #x1200000024
:method-count-assert 18
:size-assert #x24
:flag-assert #x1200000024
)
;; definition of type drawable-inline-array-ambient
(deftype drawable-inline-array-ambient (drawable-inline-array)
((paid uint8 36))
:flag-assert #x1200000044
((paid uint8 36 :offset-assert 32)
)
:method-count-assert 18
:size-assert #x44
:flag-assert #x1200000044
)
(defmethod dummy-10 drawable-tree-ambient ((obj _type_))
;; definition for method 10 of type drawable-tree-ambient
(defmethod dummy-10 drawable-tree-ambient ((obj drawable-tree-ambient))
0
)
;; TODO dummy-16
;; definition for method 16 of type drawable-tree-ambient
(defmethod dummy-16 drawable-tree-ambient ((obj drawable-tree-ambient) (arg0 object) (arg1 object))
arg1
)
;; definition of type level-hint
(deftype level-hint (process)
((text-id-to-display uint32 :offset-assert 112)
(sound-to-play basic :offset-assert 116)
@@ -52,38 +68,39 @@
(last-time uint64 :offset-assert 152)
(voicebox uint64 :offset-assert 160)
)
:heap-base #x40
:method-count-assert 16
:size-assert #xa8
:flag-assert #x10004000a8
;; inherited inspect of process
:flag-assert #x10000000a8
(:methods
(dummy-14 () none 14)
(dummy-15 () none 15)
)
)
;; definition for method 3 of type level-hint
(defmethod inspect level-hint ((obj level-hint))
(local-vars (t9-0 (function process process)))
(set! t9-0 (method-of-type process inspect))
(t9-0 obj)
(format '#t "~T~Ttext-id-to-display: ~D~%" (-> obj text-id-to-display))
(format '#t "~T~Tsound-to-play: ~A~%" (-> obj sound-to-play))
(format '#t "~T~Ttrans: #<vector @ #x~X>~%" (-> obj trans))
(format '#t "~T~Tsound-id: ~D~%" (-> obj sound-id))
(format '#t "~T~Tmode: ~A~%" (-> obj mode))
(format '#t "~T~Ttotal-time: ~D~%" (-> obj total-time))
(format '#t "~T~Ttotal-off-time: ~D~%" (-> obj total-off-time))
(format '#t "~T~Tlast-time: ~D~%" (-> obj last-time))
(format '#t "~T~Tvoicebox: ~D~%" (-> obj voicebox))
(let ((t9-0 (method-of-type process inspect)))
(t9-0 obj)
)
(format #t "~T~Ttext-id-to-display: ~D~%" (-> obj text-id-to-display))
(format #t "~T~Tsound-to-play: ~A~%" (-> obj sound-to-play))
(format #t "~T~Ttrans: #<vector @ #x~X>~%" (-> obj trans))
(format #t "~T~Tsound-id: ~D~%" (-> obj sound-id))
(format #t "~T~Tmode: ~A~%" (-> obj mode))
(format #t "~T~Ttotal-time: ~D~%" (-> obj total-time))
(format #t "~T~Ttotal-off-time: ~D~%" (-> obj total-off-time))
(format #t "~T~Tlast-time: ~D~%" (-> obj last-time))
(format #t "~T~Tvoicebox: ~D~%" (-> obj voicebox))
obj
)
;; definition of type ambient-list
(deftype ambient-list (structure)
((num-items int32 :offset-assert 0)
((num-items int32 :offset-assert 0)
(items uint32 2048 :offset-assert 4)
)
:method-count-assert 9
:size-assert #x2004
:flag-assert #x900002004
)
+2 -2
View File
@@ -22,7 +22,7 @@
(dummy-13 () none 13)
(dummy-14 () none 14)
(dummy-15 () none 15)
(dummy-16 () none 16) ;; takes at least 3 args, return type is same as the 3rd arg.
(dummy-16 (_type_ object object) object 16) ;; takes at least 3 args, return type is same as the 3rd arg.
(dummy-17 () none 17)
)
)
@@ -41,7 +41,7 @@
(dummy-13 () none 13)
(dummy-14 () none 14)
(dummy-15 () none 15)
(dummy-16 () none 16)
(dummy-16 (_type_ object object) object 16)
(dummy-17 () none 17)
)
)
@@ -11,15 +11,4 @@
:method-count-assert 18
:size-assert #x20
:flag-assert #x1200000020
(:methods
(dummy-9 () none 9)
(dummy-10 (_type_) int 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)
)
)
+1 -1
View File
@@ -255,4 +255,4 @@
:flag-assert #x900000100
)
(define *gsf-buffer* (kmalloc global #x2400 (kmalloc-flags align-64) "malloc"))
(define *gsf-buffer* (the gsf-buffer (kmalloc global #x2400 (kmalloc-flags align-64) "malloc")))
+1 -1
View File
@@ -198,7 +198,7 @@
(corner-count int32 :offset-assert 2080)
(temp-vecs vector 4 :inline :offset-assert 2096)
(mid-mask-ptrs pointer 36 :offset-assert 2160)
(mid-camera-masks ocean-mid-masks 36 :inline :offset-assert 2304)
(mid-camera-masks uint64 36 :offset-assert 2304)
(trans-mask-ptrs pointer 64 :offset-assert 2592)
(trans-camera-masks ocean-trans-mask 16 :inline :offset-assert 2848)
(trans-temp-masks ocean-trans-mask 16 :inline :offset-assert 2976)
@@ -5,6 +5,13 @@
;; name in dgo: ocean-tables
;; dgos: GAME, ENGINE
;; note: the following types aren't decompiled correctly
;; - ocean-mid-masks
;; - ocean-near-indices
;; these types have a pointer to an array of unknown length.
;; when we do get to the ocean renderer, we should probably write a special tool
;; for this file in both the compiler/decompiler.
(define *ocean-spheres-village1* (new 'static 'ocean-spheres
:spheres (new 'static 'inline-array sphere 36
(new 'static 'sphere :x -7864320.0 :z -7864320.0 :w 2224365.5)