[decompiler] Several small fixes (#775)

* fix assorted bugs

* stricter return types

* only look for functions in code files
This commit is contained in:
water111
2021-08-19 20:35:12 -04:00
committed by GitHub
parent 69d0840080
commit 11e11d2c04
48 changed files with 461 additions and 304 deletions
+1 -1
View File
@@ -561,7 +561,7 @@
(when
(and
(< 8192.0 f28-1)
(nonzero? (logand (-> *camera* master-options) 2))
(logtest? (-> *camera* master-options) 2)
)
(vector-!
(the-as vector (-> s1-0 vector))
+1 -1
View File
@@ -141,5 +141,5 @@
;; definition for method 11 of type vol-control
(defmethod TODO-RENAME-11 vol-control ((obj vol-control))
(and *display-vol-marks* (nonzero? (logand (-> obj flags) 1)))
(and *display-vol-marks* (logtest? (-> obj flags) 1))
)
+2 -4
View File
@@ -1004,9 +1004,7 @@
(+ tex-dest-base-chunk (the-as uint upload-chunk-idx))
)
;; can we possibly use existing data in VRAM?
(set! need-tex
(nonzero? (logand needed-mask (ash 1 upload-chunk-idx)))
)
(set! need-tex (logtest? needed-mask (ash 1 upload-chunk-idx)))
;; look for the start of a run of uploads.
(if (zero? chunks-to-upload-count)
(when (and (!= (-> pool ids current-dest-chunk) page-id) need-tex)
@@ -1579,7 +1577,7 @@
(dotimes (v1-0 32)
(let ((a2-0 (-> obj common-page v1-0)))
(when (and (nonzero? a2-0) ;; known common texture page
(nonzero? (logand (-> obj common-page-mask) (ash 1 v1-0))) ;; in the mask.
(and (nonzero? a2-0) (logtest? (-> obj common-page-mask) (ash 1 v1-0))) ;; in the mask.
)
;; upload it!
(upload-vram-pages obj (-> obj segment-common) a2-0 -2 (bucket-id bucket-65))
+1 -1
View File
@@ -58,7 +58,7 @@
)
(defmethod display-water-marks? water-control ((obj water-control))
(and *display-water-marks* (nonzero? (logand (-> obj flags) 1)))
(and *display-water-marks* (logtest? (-> obj flags) 1))
)
(defmethod new water-control ((allocation symbol) (type-to-make type) (arg0 process) (arg1 int) (arg2 float) (arg3 float) (arg4 float))
+1 -1
View File
@@ -69,7 +69,7 @@
(defmethod get-bit bit-array ((obj bit-array) (idx int))
"Is the bit at idx set or not?"
(let ((v1-2 (-> obj bytes (/ idx 8))))
(nonzero? (logand v1-2 (ash 1 (logand idx 7))))
(logtest? v1-2 (ash 1 (logand idx 7)))
)
)
+1 -2
View File
@@ -9,7 +9,6 @@
:bitfield #t
:type uint32
(display-marks 0)
(bit0 0) ;; TODO - nav-enemy::45
(bit1 1)
(bit2 2)
(bit3 3) ;; TODO - nav-enemy::45
@@ -402,7 +401,7 @@
(defmethod should-display? nav-control ((obj nav-control))
(and
*display-nav-marks*
(nonzero? (logand (-> obj flags) (nav-control-flags bit0 display-marks)))
(logtest? (-> obj flags) (nav-control-flags display-marks))
)
)
+1 -1
View File
@@ -115,7 +115,7 @@
(defmethod should-display? path-control ((obj path-control))
"Should we display path marks?"
(and *display-path-marks*
(nonzero? (logand (-> obj flags) (path-control-flag display)))
(logtest? (-> obj flags) (path-control-flag display))
)
)
+3 -3
View File
@@ -38,7 +38,7 @@
((let ((a0-5 obj))
(and
*display-path-marks*
(nonzero? (logand (-> a0-5 flags) (path-control-flag display)))
(logtest? (-> a0-5 flags) (path-control-flag display))
)
)
(dotimes (s5-1 (-> obj curve num-cverts))
@@ -412,12 +412,12 @@
((let ((a0-5 obj))
(and
*display-path-marks*
(nonzero? (logand (-> a0-5 flags) (path-control-flag display)))
(logtest? (-> a0-5 flags) (path-control-flag display))
)
)
(if
(and
(nonzero? (logand (-> obj flags) (path-control-flag draw-line)))
(logtest? (-> obj flags) (path-control-flag draw-line))
(> (-> obj curve num-cverts) 0)
)
(add-debug-curve2
+1 -1
View File
@@ -826,7 +826,7 @@
(dotimes (i (-> *flava-table* count))
(if (= (-> *flava-table* row i music) music)
(return (-> *flava-table* row i flava n))
(return (the-as int (-> *flava-table* row i flava n)))
)
)
0