diff --git a/decompiler/IR2/AtomicOpTypeAnalysis.cpp b/decompiler/IR2/AtomicOpTypeAnalysis.cpp index 6c5c5ccd89..59f23b1e5b 100644 --- a/decompiler/IR2/AtomicOpTypeAnalysis.cpp +++ b/decompiler/IR2/AtomicOpTypeAnalysis.cpp @@ -770,6 +770,20 @@ TypeState AsmOp::propagate_types_internal(const TypeState& input, } } + // srl out, bitfield, int + if (m_instr.kind == InstructionKind::SRL) { + auto type = dts.ts.lookup_type(result.get(m_src[0]->reg()).typespec()); + auto as_bitfield = dynamic_cast(type); + if (as_bitfield) { + int sa = m_instr.src[1].get_imm(); + int offset = sa; + int size = 32 - offset; + auto field = find_field(dts.ts, as_bitfield, offset, size, {}); + result.get(m_dst->reg()) = TP_Type::make_from_ts(coerce_to_reg_type(field.type())); + return result; + } + } + if (m_dst.has_value()) { auto kind = m_dst->reg().get_kind(); if (kind == Reg::FPR) { diff --git a/decompiler/analysis/final_output.cpp b/decompiler/analysis/final_output.cpp index 4a34c5060d..14312a40bd 100644 --- a/decompiler/analysis/final_output.cpp +++ b/decompiler/analysis/final_output.cpp @@ -199,28 +199,11 @@ std::string add_indent(const std::string& in, int indent, bool indent_first_line return result; } -std::string write_from_top_level(const Function& top_level, - const DecompilerTypeSystem& dts, - const LinkedObjectFile& file, - const std::unordered_set& skip_functions) { - auto top_form = top_level.ir2.top_form; - if (!top_form) { - return ";; ERROR: top level function was not converted to expressions. Cannot decompile.\n\n"; - } - - auto& env = top_level.ir2.env; - if (!env.has_type_analysis()) { - return ";; ERROR: top level has no type analysis. Cannot decompile.\n\n"; - } - - if (!env.has_local_vars()) { - return ";; ERROR: top level has no local vars. Cannot decompile.\n\n"; - } - - if (!env.has_reg_use()) { - return ";; ERROR: top level has no register use analysis. Cannot decompile.\n\n"; - } - +std::string write_from_top_level_form(Form* top_form, + const DecompilerTypeSystem& dts, + const LinkedObjectFile& file, + const std::unordered_set& skip_functions, + const Env& env) { std::vector forms = top_form->elts(); assert(!forms.empty()); @@ -232,7 +215,7 @@ std::string write_from_top_level(const Function& top_level, std::string result; // local vars: - auto var_dec = env.local_var_type_list(top_level.ir2.top_form, 0); + auto var_dec = env.local_var_type_list(top_form, 0); if (var_dec.local_vars) { result += pretty_print::to_string(*var_dec.local_vars); result += '\n'; @@ -424,6 +407,24 @@ std::string write_from_top_level(const Function& top_level, } } + if (!something_matched) { + auto as_cne = f.try_as_element(); + if (as_cne && as_cne->entries.size() == 1) { + auto& entry = as_cne->entries.at(0); + // a bit gross... + if (entry.condition->to_string(env) == "*debug-segment*") { + something_matched = true; + // forms = entry.body->elts(); + result += ";; this part is debug only\n"; + result += "(when *debug-segment*\n"; + + result += write_from_top_level_form(entry.body, dts, file, skip_functions, env); + + result += ")\n"; + } + } + } + if (!something_matched) { auto empty = dynamic_cast(x); if (empty) { @@ -450,4 +451,29 @@ std::string write_from_top_level(const Function& top_level, return result; } + +std::string write_from_top_level(const Function& top_level, + const DecompilerTypeSystem& dts, + const LinkedObjectFile& file, + const std::unordered_set& skip_functions) { + auto top_form = top_level.ir2.top_form; + if (!top_form) { + return ";; ERROR: top level function was not converted to expressions. Cannot decompile.\n\n"; + } + + auto& env = top_level.ir2.env; + if (!env.has_type_analysis()) { + return ";; ERROR: top level has no type analysis. Cannot decompile.\n\n"; + } + + if (!env.has_local_vars()) { + return ";; ERROR: top level has no local vars. Cannot decompile.\n\n"; + } + + if (!env.has_reg_use()) { + return ";; ERROR: top level has no register use analysis. Cannot decompile.\n\n"; + } + + return write_from_top_level_form(top_form, dts, file, skip_functions, env); +} } // namespace decompiler \ No newline at end of file diff --git a/decompiler/config/all-types.gc b/decompiler/config/all-types.gc index 65774c1ca7..d984844c99 100644 --- a/decompiler/config/all-types.gc +++ b/decompiler/config/all-types.gc @@ -5198,6 +5198,45 @@ :flag-assert #x900000010 ) +(defenum font-color + :type uint64 + (default 0) + (white 1) + (gray 2) + (orange-red 3) + (bright-orange-red 4) + (dark-yellow 5) + (bright-green 6) + (dark-blue 7) + (light-blue 8) + (dark-pink 9) + (lighter-blue 10) + (dark-light-blue 11) + (dim-white 12) + (dim-gray 13) + (orange-red-2 14) + (yellow-green 15) + (dark-green 16) + (another-gray 17) + (dark-dark-green 18) + (flat-dark-purple 19) + (yellow 20) + (blue-white 21) + (flat-dark-gray 22) + (flat-gray 23) + (flat-pink 24) + (flat-red 25) + (flat-green 26) + (flat-purple 27) + (lighter-lighter-blue 28) + (yellow-orange 29) + (yellow-green-2 30) + (another-light-blue 31) + (another-default 32) + (red-orange 33) + (another-orange-red 34) + ) + (deftype font-context (basic) ((origin vector :inline :offset-assert 16) (strip-gif vector :inline :offset-assert 32) @@ -5205,7 +5244,7 @@ (height float :offset-assert 52) (projection float :offset-assert 56) (context-vec vector :inline :offset 48) ;; added - (color int64 :offset-assert 64) + (color font-color :offset-assert 64) (color-s32 int32 :offset 64) ;; added for asm (flags uint32 :offset-assert 72) (flags-signed int32 :offset 72) ;; added for asm @@ -5217,7 +5256,7 @@ :size-assert #x58 :flag-assert #x1400000058 (:methods - (new (symbol type matrix int int float int uint) _type_ 0) + (new (symbol type matrix int int float font-color uint) _type_ 0) (set-mat! (font-context matrix) font-context 9) (set-origin! (font-context int int) font-context 10) (set-depth! (font-context int) font-context 11) @@ -5225,7 +5264,7 @@ (set-width! (font-context int) font-context 13) (set-height! (font-context int) font-context 14) (set-projection! (font-context float) font-context 15) - (set-color! (font-context int) font-context 16) + (set-color! (font-context font-color) font-context 16) (set-flags! (font-context uint) font-context 17) (set-start-line! (font-context uint) font-context 18) (set-scale! (font-context float) font-context 19) @@ -5261,9 +5300,9 @@ (justify vector 64 :inline :offset-assert 944) (color-shadow vector4w :inline :offset-assert 1968) (color-table char-color 64 :inline :offset-assert 1984) - (last-color uint64 :offset-assert 3008) + (last-color font-color :offset-assert 3008) (last-color-32 int32 :offset 3008) - (save-last-color uint64 :offset-assert 3016) + (save-last-color font-color :offset-assert 3016) (save-last-color-32 int32 :offset 3016) ;; added (buf basic :offset-assert 3024) (str-ptr uint32 :offset-assert 3028) @@ -5321,7 +5360,7 @@ (define-extern set-display-env (function display-env int int int int int int display-env)) (define-extern set-draw-env (function draw-env int int int int int int draw-env)) (define-extern get-video-mode (function symbol)) -(define-extern draw-string-xy (function string dma-buffer int int int int none)) +(define-extern draw-string-xy (function string dma-buffer int int font-color int none)) (define-extern set-draw-env-offset (function draw-env int int int draw-env)) (define-extern put-display-alpha-env (function display-env none)) (define-extern set-display2 (function display int int int int int display)) @@ -15154,7 +15193,7 @@ ((flags int32 :offset-assert 0) (bucket bucket-id :offset-assert 4) (pos vector :inline :offset-assert 16) - (color uint64 :offset-assert 32) + (color font-color :offset-assert 32) (offset vector2h :inline :offset-assert 40) (str string :offset-assert 44) ) @@ -15177,12 +15216,12 @@ (define-extern debug-set-camera-pos-rot! (function vector matrix int)) (define-extern drawable-frag-count (function drawable int)) (define-extern add-debug-light (function symbol bucket-id light vector string symbol)) -(define-extern add-debug-text-3d (function symbol bucket-id string vector rgba vector2h symbol)) +(define-extern add-debug-text-3d (function symbol bucket-id string vector font-color vector2h symbol)) (define-extern add-debug-x (function symbol bucket-id vector rgba symbol)) (define-extern add-debug-curve (function symbol bucket-id pointer int (inline-array vector) int rgba symbol)) (define-extern add-debug-sphere (function symbol bucket-id vector float rgba symbol)) (define-extern get-debug-text-3d (function debug-text-3d)) -(define-extern internal-draw-debug-text-3d (function bucket-id string vector rgba vector2h pointer)) +(define-extern internal-draw-debug-text-3d (function bucket-id string vector font-color vector2h pointer)) (define-extern get-debug-line (function debug-line)) (define-extern internal-draw-debug-line (function bucket-id vector vector rgba symbol rgba pointer)) (define-extern draw-string (function string dma-buffer font-context float)) @@ -15195,7 +15234,7 @@ (define-extern debug-draw-buffers (function symbol)) (define-extern add-debug-line2d (function symbol bucket-id vector vector vector symbol)) (define-extern add-debug-box (function symbol bucket-id vector vector rgba symbol)) -(define-extern add-debug-sphere-with-transform (function symbol bucket-id vector float matrix rgba symbol)) +(define-extern add-debug-sphere-with-transform (function symbol bucket-id vector meters matrix rgba symbol)) (define-extern add-debug-spheres (function symbol bucket-id (inline-array vector) int rgba symbol)) (define-extern add-debug-circle (function symbol bucket-id vector float rgba matrix symbol)) (define-extern add-debug-rot-matrix (function symbol bucket-id matrix vector matrix)) @@ -17421,7 +17460,7 @@ ;; - Functions -(define-extern set-font-color-alpha (function int int none)) +(define-extern set-font-color-alpha (function font-color int none)) (define-extern load-game-text-info (function string symbol kheap int)) (define-extern load-level-text-files (function int none)) (define-extern draw-debug-text-box (function font-context none)) diff --git a/decompiler/config/jak1_ntsc_black_label/var_names.jsonc b/decompiler/config/jak1_ntsc_black_label/var_names.jsonc index 404574b828..4cfc3d9937 100644 --- a/decompiler/config/jak1_ntsc_black_label/var_names.jsonc +++ b/decompiler/config/jak1_ntsc_black_label/var_names.jsonc @@ -2224,7 +2224,6 @@ "v1-11": ["v1-11", "dma-packet"] } }, - "add-debug-light": { "vars": { "s1-0": ["s1-0", "rgba"] } }, "generic-init-buffers": { "vars": { @@ -3127,5 +3126,9 @@ "r0-3": "r0" } }, + + "add-debug-outline-triangle": { + "args":["enable", "bucket", "p0", "p1", "p2", "color"] + }, "aaaaaaaaaaaaaaaaaaaaaaa": {} } diff --git a/goal_src/engine/debug/debug.gc b/goal_src/engine/debug/debug.gc index 85b323bae4..ca97504b89 100644 --- a/goal_src/engine/debug/debug.gc +++ b/goal_src/engine/debug/debug.gc @@ -113,147 +113,148 @@ ) -(defun-debug internal-draw-debug-line ((arg0 bucket-id) (arg1 vector) (arg2 vector) (arg3 rgba) (arg4 symbol) (arg5 rgba)) - (let ((sv-80 arg2) - (s2-0 arg3) - (s3-0 arg4) - (s5-0 arg5) - ) - (let ((a0-4 (current-display-frame debug-buf))) - (if (< (the-as uint (shr (+ (&- (-> a0-4 end) (the-as uint (-> a0-4 base))) 15) 4)) (the-as uint #x8000)) +(defun-debug internal-draw-debug-line ((bucket bucket-id) (p0 vector) (p1 vector) (first-color rgba) (mode symbol) (second-color rgba)) + "Draw a debug line from p0 to p1. Mode can be: + 'fade, 'fade-depth, or #f. + second-color can be -1 to just use the same color. + " + (let ((a0-4 (current-display-frame debug-buf))) + (if (< (the-as uint (shr (+ (&- (-> a0-4 end) (the-as uint (-> a0-4 base))) 15) 4)) (the-as uint #x8000)) (return (the-as pointer #f)) ) - ) - (if (or (zero? (+ s5-0 (the-as uint 1))) - (= s5-0 (static-rgba #xff #xff #xff #xff)) - ) - (set! s5-0 s2-0) - ) - (case s3-0 - (('fade) - (set! s5-0 (new 'static 'rgba - :r (shr (-> s5-0 r) 1) - :g (shr (-> s5-0 g) 1) - :b (shr (-> s5-0 b) 1) - :a (-> s5-0 a) - )) - ) - ) - (let ((s4-0 (new 'stack 'vector4w-2)) - (s1-0 (new 'stack 'vector4w-2)) + ) + (if (or (zero? (+ second-color (the-as uint 1))) + (= second-color (static-rgba #xff #xff #xff #xff)) ) - (set! (-> arg1 w) 1.0) - (set! (-> sv-80 w) 1.0) - - (when (and (transform-point-qword! (-> s4-0 vector 0) arg1) - (transform-point-qword! (-> s4-0 vector 1) sv-80) - ) - (with-dma-buffer-add-bucket ((v1-28 (current-display-frame debug-buf)) (current-display-frame bucket-group) arg0) - - (with-cnt-vif-block (v1-28) - (dma-buffer-add-gif-tag v1-28 (new 'static 'gif-tag64 :nloop 1 :eop 1 :pre 1 :nreg 4 - :prim (gif-prim line)) - (gs-reg-list rgbaq xyzf2 rgbaq xyzf2) - ) - (case s3-0 + (set! second-color first-color) + ) + (case mode + (('fade) + (set! second-color (new 'static 'rgba + :r (shr (-> second-color r) 1) + :g (shr (-> second-color g) 1) + :b (shr (-> second-color b) 1) + :a (-> second-color a) + )) + ) + ) + (let ((s4-0 (new 'stack 'vector4w-2)) + (s1-0 (new 'stack 'vector4w-2)) + ) + (set! (-> p0 w) 1.0) + (set! (-> p1 w) 1.0) + + (when (and (transform-point-qword! (-> s4-0 vector 0) p0) + (transform-point-qword! (-> s4-0 vector 1) p1) + ) + (with-dma-buffer-add-bucket ((v1-28 (current-display-frame debug-buf)) (current-display-frame bucket-group) bucket) + (with-cnt-vif-block (v1-28) + (dma-buffer-add-gif-tag v1-28 (new 'static 'gif-tag64 :nloop 1 :eop 1 :pre 1 :nreg 4 + :prim (gif-prim line)) + (gs-reg-list rgbaq xyzf2 rgbaq xyzf2) + ) + (case mode (('fade-depth) (let ((f0-3 (fminmax (* (1/ #xffffff) (the float (-> s4-0 vector 0 z))) 0.2 1.0))) - (set! (-> s1-0 vector 0 x) (the int (* (the float (-> s2-0 r)) f0-3))) - (set! (-> s1-0 vector 0 y) (the int (* (the float (-> s2-0 g)) f0-3))) - (set! (-> s1-0 vector 0 z) (the int (* (the float (-> s2-0 b)) f0-3))) + (set! (-> s1-0 vector 0 x) (the int (* (the float (-> first-color r)) f0-3))) + (set! (-> s1-0 vector 0 y) (the int (* (the float (-> first-color g)) f0-3))) + (set! (-> s1-0 vector 0 z) (the int (* (the float (-> first-color b)) f0-3))) ) - (set! (-> s1-0 vector 0 w) (the-as int (-> s2-0 a))) + (set! (-> s1-0 vector 0 w) (the-as int (-> first-color a))) ) (else - (set! (-> s1-0 vector 0 x) (the-as int (-> s2-0 r))) - (set! (-> s1-0 vector 0 y) (the-as int (-> s2-0 g))) - (set! (-> s1-0 vector 0 z) (the-as int (-> s2-0 b))) - (set! (-> s1-0 vector 0 w) (the-as int (-> s2-0 a))) - ) + (set! (-> s1-0 vector 0 x) (the-as int (-> first-color r))) + (set! (-> s1-0 vector 0 y) (the-as int (-> first-color g))) + (set! (-> s1-0 vector 0 z) (the-as int (-> first-color b))) + (set! (-> s1-0 vector 0 w) (the-as int (-> first-color a))) + ) ) - (cond - ((= s3-0 'fade-depth) - (let ((f0-7 (fminmax (* (1/ #xffffff) (the float (-> s4-0 vector 1 z))) 0.2 1.0))) - (set! (-> s1-0 vector 1 x) (the int (* (the float (-> s5-0 r)) f0-7))) - (set! (-> s1-0 vector 1 y) (the int (* (the float (-> s5-0 g)) f0-7))) - (set! (-> s1-0 vector 1 z) (the int (* (the float (-> s5-0 b)) f0-7))) - ) - (set! (-> s1-0 vector 1 w) (the-as int (-> s5-0 a))) - ) - (else - (set! (-> s1-0 vector 1 x) (the-as int (-> s5-0 r))) - (set! (-> s1-0 vector 1 y) (the-as int (-> s5-0 g))) - (set! (-> s1-0 vector 1 z) (the-as int (-> s5-0 b))) - (set! (-> s1-0 vector 1 w) (the-as int (-> s5-0 a))) - ) - ) - (+! (-> s4-0 vector 0 z) -8192) - (+! (-> s4-0 vector 1 z) -8192) - (dma-buffer-add-uint128 v1-28 (-> s1-0 quad 0) - (-> s4-0 quad 0) - (-> s1-0 quad 1) - (-> s4-0 quad 1) - ) + (cond + ((= mode 'fade-depth) + (let ((f0-7 (fminmax (* (1/ #xffffff) (the float (-> s4-0 vector 1 z))) 0.2 1.0))) + (set! (-> s1-0 vector 1 x) (the int (* (the float (-> second-color r)) f0-7))) + (set! (-> s1-0 vector 1 y) (the int (* (the float (-> second-color g)) f0-7))) + (set! (-> s1-0 vector 1 z) (the int (* (the float (-> second-color b)) f0-7))) + ) + (set! (-> s1-0 vector 1 w) (the-as int (-> second-color a))) + ) + (else + (set! (-> s1-0 vector 1 x) (the-as int (-> second-color r))) + (set! (-> s1-0 vector 1 y) (the-as int (-> second-color g))) + (set! (-> s1-0 vector 1 z) (the-as int (-> second-color b))) + (set! (-> s1-0 vector 1 w) (the-as int (-> second-color a))) ) ) + (+! (-> s4-0 vector 0 z) -8192) + (+! (-> s4-0 vector 1 z) -8192) + (dma-buffer-add-uint128 v1-28 (-> s1-0 quad 0) + (-> s4-0 quad 0) + (-> s1-0 quad 1) + (-> s4-0 quad 1) + ) ) ) + ) ) ) + -(defun-debug internal-draw-debug-text-3d ((arg0 bucket-id) (arg1 string) (arg2 vector) (arg3 rgba) (arg4 vector2h)) +(defun-debug internal-draw-debug-text-3d ((bucket bucket-id) (str string) (location vector) (font-color-id font-color) (offset vector2h)) + "Draw text at the given location (in 3D), with a 2D offset." (let ((s2-0 (new 'stack-no-clear 'vector4w))) (set! (-> s2-0 quad) (the-as uint128 0)) - (when (transform-point-qword! (the-as vector4w s2-0) arg2) - - (with-dma-buffer-add-bucket ((s3-0 (current-display-frame debug-buf)) (current-display-frame bucket-group) arg0) - + (when (transform-point-qword! (the-as vector4w s2-0) location) + + (with-dma-buffer-add-bucket ((s3-0 (current-display-frame debug-buf)) (current-display-frame bucket-group) bucket) + (let ((a2-2 (new 'stack 'font-context *font-default-matrix* - (+ (+ (-> arg4 x) -1792) (/ (-> s2-0 x) 16)) - (- (+ (+ (-> arg4 y) -8) (/ (-> s2-0 y) 16)) - (-> *video-parms* screen-miny) - ) - 0.0 - (the-as int arg3) - (the-as uint 3) - ))) + (+ (+ (-> offset x) -1792) (/ (-> s2-0 x) 16)) + (- (+ (+ (-> offset y) -8) (/ (-> s2-0 y) 16)) + (-> *video-parms* screen-miny) + ) + 0.0 + font-color-id + (the-as uint 3) + ))) (let ((v1-9 a2-2)) (set! (-> v1-9 origin z) (the float (/ (-> s2-0 z) 16))) ) - (draw-string arg1 s3-0 a2-2) + (draw-string str s3-0 a2-2) ) ) ) ) ) -(defun-debug add-debug-outline-triangle ((arg0 symbol) (arg1 bucket-id) (arg2 vector) (arg3 vector) (arg4 vector) (arg5 rgba)) - (when arg0 - (add-debug-line #t arg1 arg2 arg3 arg5 #f (the-as rgba -1)) - (add-debug-line #t arg1 arg3 arg4 arg5 #f (the-as rgba -1)) - (add-debug-line #t arg1 arg4 arg2 arg5 #f (the-as rgba -1)) +(defun-debug add-debug-outline-triangle ((enable symbol) (bucket bucket-id) (p0 vector) (p1 vector) (p2 vector) (color rgba)) + "Draw outline of a triangle using lines." + (when enable + (add-debug-line #t bucket p0 p1 color #f (the-as rgba -1)) + (add-debug-line #t bucket p1 p2 color #f (the-as rgba -1)) + (add-debug-line #t bucket p2 p0 color #f (the-as rgba -1)) ) #f ) -(defun-debug add-debug-triangle-normal ((arg0 symbol) (arg1 bucket-id) (arg2 vector) (arg3 vector) (arg4 vector) (arg5 rgba)) - - (when arg0 +(defun-debug add-debug-triangle-normal ((enable symbol) (bucket bucket-id) (p0 vector) (p1 vector) (p2 vector) (color rgba)) + "Draw the normal of a triangle, with length of 1 meter." + (when enable (let ((s4-0 (new 'stack-no-clear 'vector)) - (s3-0 (vector-3pt-cross! (new 'stack-no-clear 'vector) arg2 arg3 arg4)) + (s3-0 (vector-3pt-cross! (new 'stack-no-clear 'vector) p0 p1 p2)) ) (vector-float/! s3-0 s3-0 (* (1/ METER_LENGTH) (vector-length s3-0))) - (vector+! s4-0 arg2 arg3) - (vector+! s4-0 s4-0 arg4) + (vector+! s4-0 p0 p1) + (vector+! s4-0 s4-0 p2) (vector-float/! s4-0 s4-0 3.0) (vector+! s3-0 s3-0 s4-0) - (add-debug-line #t arg1 s4-0 s3-0 arg5 #f (the-as rgba -1)) + (add-debug-line #t bucket s4-0 s3-0 color #f (the-as rgba -1)) ) ) #f ) -(defun-debug add-debug-flat-triangle ((enable-draw symbol) (bucket bucket-id) (p0 vector) (p1 vector) (p2 vector) (arg5 rgba)) +(defun-debug add-debug-flat-triangle ((enable-draw symbol) (bucket bucket-id) (p0 vector) (p1 vector) (p2 vector) (color rgba)) + "Draw a triangle with flat shading" (if (not enable-draw) (return #f) ) @@ -273,10 +274,10 @@ (dma-buffer-add-gif-tag v1-9 (new 'static 'gif-tag64 :nloop 1 :eop 1 :pre 1 :nreg 6 :prim (gif-prim tri)) (gs-reg-list rgbaq xyzf2 rgbaq xyzf2 rgbaq xyzf2) ) - (set! (-> s4-0 vector 0 x) (the-as int (-> arg5 r))) - (set! (-> s4-0 vector 0 y) (the-as int (-> arg5 g))) - (set! (-> s4-0 vector 0 z) (the-as int (-> arg5 b))) - (set! (-> s4-0 vector 0 w) (the-as int (-> arg5 a))) + (set! (-> s4-0 vector 0 x) (the-as int (-> color r))) + (set! (-> s4-0 vector 0 y) (the-as int (-> color g))) + (set! (-> s4-0 vector 0 z) (the-as int (-> color b))) + (set! (-> s4-0 vector 0 w) (the-as int (-> color a))) (set! (-> s5-0 vector 0 z) (+ (-> s5-0 vector 0 z) -8192)) (set! (-> s5-0 vector 1 z) (+ (-> s5-0 vector 1 z) -8192)) (set! (-> s5-0 vector 2 z) (+ (-> s5-0 vector 2 z) -8192)) @@ -294,6 +295,16 @@ #f ) + +;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Buffered debug draw +;;;;;;;;;;;;;;;;;;;;;;;;;;; + +;; Some of the debug draw stuff just adds a line to a list of lines to draw. +;; This is used when pausing - the actual calls to debug-draw-line won't happen, but +;; we won't clear the debug draw buffer so they will still be drawn. + + (when *debug-segment* (deftype debug-line (structure) @@ -314,7 +325,7 @@ ((flags int32 :offset-assert 0) (bucket bucket-id :offset-assert 4) (pos vector :inline :offset-assert 16) - (color uint64 :offset-assert 32) + (color font-color :offset-assert 32) (offset vector2h :inline :offset-assert 40) (str string :offset-assert 44) ) @@ -332,20 +343,22 @@ :flag-assert #x90000000c ) - (define *debug-lines* (the (inline-array debug-line) (malloc 'debug #x100000))) - (define *debug-lines-trk* (new 'debug 'debug-tracking-thang)) - (set! (-> *debug-lines-trk* allocated-length) 16384) +;; allocate debug draw buffers +(define *debug-lines* (the (inline-array debug-line) (malloc 'debug #x100000))) +(define *debug-lines-trk* (new 'debug 'debug-tracking-thang)) +(set! (-> *debug-lines-trk* allocated-length) 16384) +(define *debug-text-3ds* (the (inline-array debug-text-3d) (malloc 'debug #x6000))) +(define *debug-text-3d-trk* (new 'debug 'debug-tracking-thang)) +(set! (-> *debug-text-3d-trk* allocated-length) 512) - (define *debug-text-3ds* (the (inline-array debug-text-3d) (malloc 'debug #x6000))) - (define *debug-text-3d-trk* (new 'debug 'debug-tracking-thang)) - (set! (-> *debug-text-3d-trk* allocated-length) 512) - - (dotimes (i (-> *debug-text-3d-trk* allocated-length)) - (set! (-> *debug-text-3ds* i str) (new 'debug 'string 80 (the string #f))) - ) +(dotimes (i (-> *debug-text-3d-trk* allocated-length)) + (set! (-> *debug-text-3ds* i str) (new 'debug 'string 80 (the string #f))) ) +) + (defun-debug get-debug-line () + "Allocate a debug-line from the list." (cond ((< (-> *debug-lines-trk* length) (-> *debug-lines-trk* allocated-length)) (+! (-> *debug-lines-trk* length) 1) @@ -358,6 +371,7 @@ ) (defun-debug get-debug-text-3d () + "Allocate a debug text 3d from the list." (cond ((< (-> *debug-text-3d-trk* length) (-> *debug-text-3d-trk* allocated-length)) (+! (-> *debug-text-3d-trk* length) 1) @@ -370,6 +384,7 @@ ) (defun-debug debug-reset-buffers () + "Clear all allocated debug things" (set! (-> *debug-lines-trk* length) 0) (set! (-> *debug-text-3d-trk* length) 0) (set! *debug-draw-pauseable* #f) @@ -377,6 +392,7 @@ ) (defun-debug debug-draw-buffers () + "Draw all debug lines and debug text." (dotimes (gp-0 (-> *debug-lines-trk* length)) (let ((v1-1 (-> *debug-lines* gp-0))) (internal-draw-debug-line @@ -395,7 +411,7 @@ (-> v1-8 bucket) (-> v1-8 str) (-> v1-8 pos) - (the-as rgba (-> v1-8 color)) + (-> v1-8 color) (-> v1-8 offset) ) ) @@ -403,23 +419,24 @@ #f ) -(defun-debug add-debug-line ((arg0 symbol) (arg1 bucket-id) (arg2 vector) (arg3 vector) (arg4 rgba) (arg5 symbol) (arg6 rgba)) - (when arg0 +(defun-debug add-debug-line ((enable-draw symbol) (bucket bucket-id) (p0 vector) (p1 vector) (color rgba) (mode symbol) (color2 rgba)) + "Draw a debug line between p0 and p1, in 3D." + (when enable-draw (cond (*debug-draw-pauseable* (let ((v1-2 (get-debug-line))) (when v1-2 - (set! (-> v1-2 bucket) arg1) - (set! (-> v1-2 v1 quad) (-> arg2 quad)) - (set! (-> v1-2 v2 quad) (-> arg3 quad)) - (set! (-> v1-2 color) arg4) - (set! (-> v1-2 color2) arg6) - (set! (-> v1-2 mode) arg5) + (set! (-> v1-2 bucket) bucket) + (set! (-> v1-2 v1 quad) (-> p0 quad)) + (set! (-> v1-2 v2 quad) (-> p1 quad)) + (set! (-> v1-2 color) color) + (set! (-> v1-2 color2) color2) + (set! (-> v1-2 mode) mode) ) ) ) (else - (internal-draw-debug-line arg1 arg2 arg3 arg4 arg5 arg6) + (internal-draw-debug-line bucket p0 p1 color mode color2) ) ) ) @@ -427,6 +444,7 @@ ) (defun-debug add-debug-line2d ((arg0 symbol) (arg1 bucket-id) (arg2 vector) (arg3 vector) (arg4 vector)) + "Draw a line in screen coordinates" (if (not arg0) (return #f) ) @@ -461,6 +479,7 @@ ) (defun-debug add-debug-box ((arg0 symbol) (arg1 bucket-id) (arg2 vector) (arg3 vector) (arg4 rgba)) + "Draw an axis-aligned box" (let ((s5-0 (new-stack-vector0))) (set! (-> s5-0 quad) (-> arg2 quad)) (let ((s1-0 (new-stack-vector0))) @@ -509,6 +528,7 @@ ) (defun-debug add-debug-x ((arg0 symbol) (arg1 bucket-id) (arg2 vector) (arg3 rgba)) + "Draw an X in the xz plane" (if (not arg0) (return #f) ) @@ -525,7 +545,8 @@ #f ) -(defun-debug add-debug-text-3d ((arg0 symbol) (arg1 bucket-id) (arg2 string) (arg3 vector) (arg4 rgba) (arg5 vector2h)) +(defun-debug add-debug-text-3d ((arg0 symbol) (arg1 bucket-id) (arg2 string) (arg3 vector) (arg4 font-color) (arg5 vector2h)) + "Draw text at the given point. arg4 is the font-color index. arg5 is an offset and can be #f." (when arg0 (cond (*debug-draw-pauseable* @@ -545,7 +566,7 @@ 0 ) ) - (set! (-> v1-2 color) (the-as uint arg4)) + (set! (-> v1-2 color) arg4) (let ((a0-6 0) (a1-2 (-> arg2 data)) (v1-4 (-> v1-2 str data)) @@ -574,7 +595,9 @@ #f ) -(defun-debug add-debug-sphere-with-transform ((arg0 symbol) (arg1 bucket-id) (arg2 vector) (arg3 float) (arg4 matrix) (arg5 rgba)) +(defun-debug add-debug-sphere-with-transform ((arg0 symbol) (arg1 bucket-id) (arg2 vector) (arg3 meters) (arg4 matrix) (arg5 rgba)) + "Transform the given point by the given transform, then draw a debug sphere there. The orientation of the debug sphere itself + is not changed by the transform, just its origin." (rlet ((acc :class vf) (vf0 :class vf) (vf1 :class vf) @@ -603,20 +626,23 @@ ) ) -(defun-debug add-debug-sphere ((arg0 symbol) (arg1 bucket-id) (arg2 vector) (arg3 float) (arg4 rgba)) +(defun-debug add-debug-sphere ((arg0 symbol) (arg1 bucket-id) (arg2 vector) (arg3 meters) (arg4 rgba)) + "Add a debug sphere at the given point. arg3 is radius." (if arg0 (add-debug-sphere-from-table arg1 arg2 arg3 arg4) ) #f ) -(defun-debug add-debug-text-sphere ((arg0 symbol) (arg1 bucket-id) (arg2 vector) (arg3 float) (arg4 string) (arg5 rgba)) +(defun-debug add-debug-text-sphere ((arg0 symbol) (arg1 bucket-id) (arg2 vector) (arg3 meters) (arg4 string) (arg5 rgba)) + "Add a debug sphere at the given point, withe some text. The color is for the sphere - the text is color 0." (add-debug-sphere arg0 arg1 arg2 arg3 arg5) - (add-debug-text-3d arg0 arg1 arg4 arg2 (new 'static 'rgba) (the-as vector2h #f)) + (add-debug-text-3d arg0 arg1 arg4 arg2 (font-color default) (the-as vector2h #f)) #f ) (defun-debug add-debug-spheres ((arg0 symbol) (arg1 bucket-id) (arg2 (inline-array vector)) (arg3 int) (arg4 rgba)) + "Add a bunch of spheres. The radius is taken from the w component of the origin." (when arg0 (let ((s4-0 (-> arg2 0))) (countdown (s3-0 arg3) @@ -795,7 +821,7 @@ (if (!= arg5 0.0) (set! (-> sv-96 y) arg5) ) - (add-debug-text-3d #t arg1 (string-format "~d" s0-0) sv-96 (the rgba 1) (the vector2h #f)) + (add-debug-text-3d #t arg1 (string-format "~d" s0-0) sv-96 (font-color white) (the vector2h #f)) (add-debug-x #t arg1 sv-96 (if (= s0-0 arg6) (static-rgba #xff #xff #xff #x80) arg4 diff --git a/goal_src/engine/debug/menu.gc b/goal_src/engine/debug/menu.gc index c962f500e3..c178378b7d 100644 --- a/goal_src/engine/debug/menu.gc +++ b/goal_src/engine/debug/menu.gc @@ -38,7 +38,7 @@ (set! (-> gp-0 root-menu) #f) (set! (-> gp-0 joypad-func) #f) (set! (-> gp-0 joypad-item) #f) - (set! (-> gp-0 font) (new 'debug 'font-context *font-default-matrix* 0 0 0.0 0 (the-as uint 3))) + (set! (-> gp-0 font) (new 'debug 'font-context *font-default-matrix* 0 0 0.0 (font-color default) (the-as uint 3))) gp-0 ) ) @@ -618,9 +618,9 @@ (defun debug-menu-item-submenu-render ((arg0 debug-menu-item-submenu) (arg1 int) (arg2 int) (arg3 int) (arg4 symbol)) (let ((s5-0 (-> arg0 parent context font))) (set-origin! s5-0 arg1 arg2) - (set! (-> s5-0 color) (cond ((zero? arg3) 12) - (arg4 11) - (else 13) + (set! (-> s5-0 color) (cond ((zero? arg3) (font-color dim-white)) + (arg4 (font-color dark-light-blue)) + (else (font-color dim-gray)) )) (with-dma-buffer-add-bucket ((s3-0 (current-display-frame debug-buf)) (current-display-frame bucket-group) @@ -638,17 +638,17 @@ (set! (-> v1-2 color) (cond ((> (-> arg0 hilite-timer) 0) (1-! (-> arg0 hilite-timer)) - 10 + (font-color lighter-blue) ) ((< (-> arg0 hilite-timer) 0) (1+! (-> arg0 hilite-timer)) - 14 + (font-color orange-red-2) ) ((nonzero? arg3) - 13 + (font-color dim-gray) ) (else - 12 + (font-color dim-white) ) ) ) @@ -666,19 +666,19 @@ (set-origin! v1-2 arg1 arg2) (set! (-> v1-2 color) (cond ((= (-> arg0 is-on) 'invalid) - 19 + (font-color flat-dark-purple) ) ((-> arg0 is-on) (if (zero? arg3) - 15 - 16 + (font-color yellow-green) + (font-color dark-green) ) ) ((zero? arg3) - 17 + (font-color another-gray) ) (else - 18 + (font-color dark-dark-green) ) ) ) @@ -697,15 +697,15 @@ (set! (-> s5-0 color) (cond ((zero? arg3) (if (-> arg0 grabbed-joypad-p) - 10 - 12 + (font-color lighter-blue) + (font-color dim-white) ) ) (arg4 - 11 + (font-color dark-light-blue) ) (else - 13 + (font-color dim-gray) ) ) ) @@ -796,8 +796,8 @@ (while (not (null? s1-1)) (when (= s0-1 arg3) (set! (-> arg0 context font color) (if (nonzero? arg4) - 13 - 12 + (font-color dim-gray) + (font-color dim-white) ) ) (set-origin! (-> arg0 context font) s3-1 s2-1) diff --git a/goal_src/engine/game/game-info.gc b/goal_src/engine/game/game-info.gc index ae81eeb8b6..83677382f7 100644 --- a/goal_src/engine/game/game-info.gc +++ b/goal_src/engine/game/game-info.gc @@ -642,7 +642,7 @@ (bucket-id debug-draw1) (-> obj name) (-> obj trans) - (new 'static 'rgba :r #x1) + (font-color white) (new 'static 'vector2h :data (new 'static 'array int16 2 0 8)) ) (let ((a3-2 (vector-z-quaternion! (new-stack-vector0) (-> obj quat)))) diff --git a/goal_src/engine/game/main.gc b/goal_src/engine/game/main.gc index d5b00486df..18983ed3ee 100644 --- a/goal_src/engine/game/main.gc +++ b/goal_src/engine/game/main.gc @@ -1146,7 +1146,7 @@ (when *display-deci-count* (let ((s2-1 draw-string-xy)) (format (clear *temp-string*) "~D" *deci-count*) - (s2-1 *temp-string* debug-buf 448 210 0 3) + (s2-1 *temp-string* debug-buf 448 210 (font-color default) 3) ) ) @@ -1183,7 +1183,7 @@ (if (= *master-mode* 'pause) (draw-string-xy (lookup-text! *common-text* (game-text-id pause) #f) - s3-1 256 160 3 39) + s3-1 256 160 (font-color orange-red) 39) ) ;; draw console text on screen @@ -1192,7 +1192,7 @@ s3-1 (the int (-> *font-context* origin x)) a3-8 - 0 + (font-color default) 3 ) ) diff --git a/goal_src/engine/gfx/font-h.gc b/goal_src/engine/gfx/font-h.gc index 8a656a12c8..d8f49ed058 100644 --- a/goal_src/engine/gfx/font-h.gc +++ b/goal_src/engine/gfx/font-h.gc @@ -16,6 +16,45 @@ ;; 16 ;; 32 (use size 24) +(defenum font-color + :type uint64 + (default 0) + (white 1) + (gray 2) + (orange-red 3) + (bright-orange-red 4) + (dark-yellow 5) + (bright-green 6) + (dark-blue 7) + (light-blue 8) + (dark-pink 9) + (lighter-blue 10) + (dark-light-blue 11) + (dim-white 12) + (dim-gray 13) + (orange-red-2 14) + (yellow-green 15) + (dark-green 16) + (another-gray 17) + (dark-dark-green 18) + (flat-dark-purple 19) + (yellow 20) + (blue-white 21) + (flat-dark-gray 22) + (flat-gray 23) + (flat-pink 24) + (flat-red 25) + (flat-green 26) + (flat-purple 27) + (lighter-lighter-blue 28) + (yellow-orange 29) + (yellow-green-2 30) + (another-light-blue 31) + (another-default 32) + (red-orange 33) + (another-orange-red 34) + ) + (deftype char-verts (structure) ((pos vector 4 :inline :offset-assert 0) (color vector 4 :inline :offset-assert 64) @@ -51,7 +90,7 @@ (height float :offset-assert 52) (projection float :offset-assert 56) (context-vec vector :inline :offset 48) ;; added - (color int64 :offset-assert 64) + (color font-color :offset-assert 64) (color-s32 int32 :offset 64) ;; added for asm (flags uint32 :offset-assert 72) (flags-signed int32 :offset 72) ;; added for asm @@ -63,7 +102,7 @@ :size-assert #x58 :flag-assert #x1400000058 (:methods - (new (symbol type matrix int int float int uint) _type_ 0) + (new (symbol type matrix int int float font-color uint) _type_ 0) (set-mat! (font-context matrix) font-context 9) (set-origin! (font-context int int) font-context 10) (set-depth! (font-context int) font-context 11) @@ -71,7 +110,7 @@ (set-width! (font-context int) font-context 13) (set-height! (font-context int) font-context 14) (set-projection! (font-context float) font-context 15) - (set-color! (font-context int) font-context 16) + (set-color! (font-context font-color) font-context 16) (set-flags! (font-context uint) font-context 17) (set-start-line! (font-context uint) font-context 18) (set-scale! (font-context float) font-context 19) @@ -130,7 +169,7 @@ obj ) -(defmethod set-color! font-context ((obj font-context) (color int)) +(defmethod set-color! font-context ((obj font-context) (color font-color)) (declare (inline)) (set! (-> obj color) color) @@ -158,18 +197,7 @@ obj ) -(defmethod - new - font-context - ((allocation symbol) - (type-to-make type) - (mat matrix) - (x int) - (y int) - (z float) - (color int) - (flags uint) - ) +(defmethod new font-context ((allocation symbol) (type-to-make type) (mat matrix) (x int) (y int) (z float) (color font-color) (flags uint)) (let ((obj (object-new allocation type-to-make (the-as int (-> type-to-make size))) @@ -245,9 +273,9 @@ (justify vector 64 :inline :offset-assert 944) (color-shadow vector4w :inline :offset-assert 1968) (color-table char-color 64 :inline :offset-assert 1984) - (last-color uint64 :offset-assert 3008) + (last-color font-color :offset-assert 3008) (last-color-32 int32 :offset 3008) - (save-last-color uint64 :offset-assert 3016) + (save-last-color font-color :offset-assert 3016) (save-last-color-32 int32 :offset 3016) ;; added (buf basic :offset-assert 3024) (str-ptr uint32 :offset-assert 3028) @@ -722,4 +750,4 @@ (define-extern draw-string (function string dma-buffer font-context float)) - +(define-extern draw-string-xy (function string dma-buffer int int font-color int none)) \ No newline at end of file diff --git a/goal_src/engine/gfx/font.gc b/goal_src/engine/gfx/font.gc index e3c7f1a155..4969f9ae64 100644 --- a/goal_src/engine/gfx/font.gc +++ b/goal_src/engine/gfx/font.gc @@ -2231,7 +2231,7 @@ ) ) -(defun draw-string-xy ((arg0 string) (arg1 dma-buffer) (arg2 int) (arg3 int) (arg4 int) (arg5 int)) +(defun draw-string-xy ((arg0 string) (arg1 dma-buffer) (arg2 int) (arg3 int) (arg4 font-color) (arg5 int)) ;(format #t "call to ds: ~A~%" arg0) (let ((a2-2 (new 'stack 'font-context *font-default-matrix* diff --git a/goal_src/engine/gfx/hw/display.gc b/goal_src/engine/gfx/hw/display.gc index 304a1cae51..62e59dd448 100644 --- a/goal_src/engine/gfx/hw/display.gc +++ b/goal_src/engine/gfx/hw/display.gc @@ -5,8 +5,6 @@ ;; name in dgo: display ;; dgos: GAME, ENGINE -;; todo - move to font-h -(define-extern draw-string-xy (function string dma-buffer int int int int none)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; TIME @@ -282,8 +280,8 @@ ) -(define *font-context* (new 'global 'font-context *font-default-matrix* 0 24 0.0 0 (the uint 3))) -(define *pause-context* (new 'global 'font-context *font-default-matrix* 256 170 0.0 3 (the uint 3))) +(define *font-context* (new 'global 'font-context *font-default-matrix* 0 24 0.0 (font-color default) (the uint 3))) +(define *pause-context* (new 'global 'font-context *font-default-matrix* 256 170 0.0 (font-color orange-red) (the uint 3))) @@ -412,7 +410,7 @@ (cond (*profile-ticks* (draw-string-xy (string-format "~5D" (-> worst-time-cache (/ bar-pos 10))) - buf 488 (+ bar-pos 8) 0 17) + buf 488 (+ bar-pos 8) (font-color default) 17) (the float (-> worst-time-cache (/ bar-pos 10))) ) (else @@ -424,7 +422,7 @@ (the float *ticks-per-frame*) ))) (draw-string-xy (string-format "~5,,2f" f30-0) buf 488 (+ bar-pos 8) - (if (>= f30-0 100.0) 3 0) ;; turn red if over 100. + (if (>= f30-0 100.0) (font-color orange-red) (font-color default)) ;; turn red if over 100. 17 ) f30-0 diff --git a/goal_src/engine/nav/path.gc b/goal_src/engine/nav/path.gc index 358bd92232..c456ef50f3 100644 --- a/goal_src/engine/nav/path.gc +++ b/goal_src/engine/nav/path.gc @@ -29,7 +29,7 @@ (the-as bucket-id s3-0) *temp-string* (-> obj process root trans) - (new 'static 'rgba :r #x3) + (font-color orange-red) (the-as vector2h #f) ) ) @@ -77,7 +77,7 @@ (the-as bucket-id s1-0) *temp-string* s4-1 - (new 'static 'rgba :r #x4) + (font-color bright-orange-red) (the-as vector2h #f) ) ) @@ -403,7 +403,7 @@ (the-as bucket-id s3-0) *temp-string* (-> obj process root trans) - (new 'static 'rgba :r #x3) + (font-color orange-red) (the-as vector2h #f) ) ) @@ -449,7 +449,7 @@ (the-as bucket-id s1-0) *temp-string* s4-1 - (new 'static 'rgba :r #x4) + (font-color bright-orange-red) (the-as vector2h #f) ) ) diff --git a/goal_src/engine/ps2/memcard-h.gc b/goal_src/engine/ps2/memcard-h.gc index 5c5e0aa924..90c6518773 100644 --- a/goal_src/engine/ps2/memcard-h.gc +++ b/goal_src/engine/ps2/memcard-h.gc @@ -93,7 +93,7 @@ ) ) ) - (draw-string-xy *temp-string* dma-buf 32 (+ (* 12 slot-idx) 8) 3 1) + (draw-string-xy *temp-string* dma-buf 32 (+ (* 12 slot-idx) 8) (font-color orange-red) 1) ) ) (none) diff --git a/goal_src/engine/sound/gsound.gc b/goal_src/engine/sound/gsound.gc index 76c6b515d5..993bc02200 100644 --- a/goal_src/engine/sound/gsound.gc +++ b/goal_src/engine/sound/gsound.gc @@ -734,12 +734,12 @@ (dotimes (ch 24) (draw-string-xy (if (zero? (-> *sound-iop-info* chinfo ch)) "." "X") - buf (+ (* ch 16) 16) 48 0 1) + buf (+ (* ch 16) 16) 48 (font-color default) 1) ) (dotimes (ch 24) (draw-string-xy (if (zero? (-> *sound-iop-info* chinfo (+ ch 24))) "." "X") - buf (+ (* ch 16) 16) 64 0 1) + buf (+ (* ch 16) 16) 64 (font-color default) 1) ) 0 ) @@ -748,11 +748,11 @@ (draw-string-xy (string-format "~8D [~4D]" (-> *sound-iop-info* freemem) (shr (-> *sound-iop-info* freemem) 10)) - buf 32 96 0 1) + buf 32 96 (font-color default) 1) (draw-string-xy (string-format "~8D [~4D]" (-> *sound-iop-info* freemem2) (shr (-> *sound-iop-info* freemem2) 10)) - buf 32 64 0 1) + buf 32 64 (font-color default) 1) 0 ) diff --git a/goal_src/engine/ui/credits.gc b/goal_src/engine/ui/credits.gc index 7c9273b128..ce918151ef 100644 --- a/goal_src/engine/ui/credits.gc +++ b/goal_src/engine/ui/credits.gc @@ -59,7 +59,7 @@ 0 0 0.0 - 0 + (font-color default) (the-as uint 3) ) ) @@ -137,7 +137,7 @@ (gp-0 2815) (s3-0 0) (s2-0 #t) - (s5-0 (new 'stack 'font-context *font-default-matrix* 31 0 0.0 0 (the-as uint 3))) + (s5-0 (new 'stack 'font-context *font-default-matrix* 31 0 0.0 (font-color default) (the-as uint 3))) ) (let ((v1-2 s5-0)) (set! (-> v1-2 width) (the float 450)) diff --git a/goal_src/engine/ui/text.gc b/goal_src/engine/ui/text.gc index 69000a30e6..6b1e19283a 100644 --- a/goal_src/engine/ui/text.gc +++ b/goal_src/engine/ui/text.gc @@ -357,7 +357,7 @@ (none) ) -(defun set-font-color-alpha ((idx int) (alpha int)) +(defun set-font-color-alpha ((idx font-color) (alpha int)) "Set the alpha for a given color index" (set! (-> *font-work* color-table idx color 0 a) alpha) (set! (-> *font-work* color-table idx color 1 a) alpha) @@ -436,7 +436,7 @@ (the int (-> font-ctxt origin x)) (the int (-> font-ctxt origin y)) 0.0 - 0 + (font-color default) (the-as uint 3) ) ) @@ -603,7 +603,7 @@ (set-font-color-alpha (-> font-ctxt color) offset-thing) (draw-string *game-text-line* s1-1 gp-0) (set-font-color-alpha (-> font-ctxt color) 128) - (set! (-> gp-0 color) (the-as int (-> *font-work* last-color))) + (set! (-> gp-0 color) (-> *font-work* last-color)) (let ((a3-3 (-> s1-1 base))) (let ((v1-127 (the-as object (-> s1-1 base)))) (set! diff --git a/goal_src/examples/debug-draw-example.gc b/goal_src/examples/debug-draw-example.gc index d5e92e4356..1c045dc74c 100644 --- a/goal_src/examples/debug-draw-example.gc +++ b/goal_src/examples/debug-draw-example.gc @@ -14,38 +14,38 @@ "Debugging function to set the camera's position and orientation" ;; update to compute the perspective matrix. (update-math-camera - *math-camera* - (-> *setting-control* current video-mode) - (-> *setting-control* current aspect-ratio) - ) - + *math-camera* + (-> *setting-control* current video-mode) + (-> *setting-control* current aspect-ratio) + ) + ;; copy the input rotation (matrix-copy! (-> *math-camera* inv-camera-rot) inv-rot) ;; inverse of rotation matrix matrix is its transpose (matrix-transpose! (-> *math-camera* camera-rot) (-> *math-camera* inv-camera-rot)) - + ;; fake some value here (set! (-> *math-camera* fov-correction-factor) 1.0) - + ;; do the math (set! (-> *math-camera* trans quad) (-> location quad)) - (let ((cam-temp (-> *math-camera* camera-temp)) + (let ((cam-temp (-> *math-camera* camera-temp)) (cam-rot (-> *math-camera* camera-rot)) (inv-cam-rot (-> *math-camera* inv-camera-rot)) (cam-trans (-> *math-camera* trans)) ) - (let ((rotated-trans (new-stack-vector0))) - (set! (-> rotated-trans x) (- (-> cam-trans x))) - (set! (-> rotated-trans y) (- (-> cam-trans y))) - (set! (-> rotated-trans z) (- (-> cam-trans z))) - (set! (-> rotated-trans w) 1.0) - (vector-matrix*! rotated-trans rotated-trans cam-rot) - (set! (-> cam-rot vector 3 quad) (-> rotated-trans quad)) + (let ((rotated-trans (new-stack-vector0))) + (set! (-> rotated-trans x) (- (-> cam-trans x))) + (set! (-> rotated-trans y) (- (-> cam-trans y))) + (set! (-> rotated-trans z) (- (-> cam-trans z))) + (set! (-> rotated-trans w) 1.0) + (vector-matrix*! rotated-trans rotated-trans cam-rot) + (set! (-> cam-rot vector 3 quad) (-> rotated-trans quad)) + ) + (matrix*! cam-temp cam-rot (-> *math-camera* perspective)) + (set! (-> inv-cam-rot vector 3 quad) (-> cam-trans quad)) ) - (matrix*! cam-temp cam-rot (-> *math-camera* perspective)) - (set! (-> inv-cam-rot vector 3 quad) (-> cam-trans quad)) - ) - + (none) ) @@ -87,7 +87,7 @@ (add-debug-x #t (bucket-id debug-draw0) (new 'static 'vector) (new 'static 'rgba :g #x80 :a #x80)) (add-debug-box #t (bucket-id debug-draw0) p0 p2 (new 'static 'rgba :b #x80 :a #x80)) (add-debug-flat-triangle #t (bucket-id debug-draw0) p0 p1 p2 (new 'static 'rgba :r #x80)) - (add-debug-text-3d #t (bucket-id debug-draw0) "triangle!" p0 (the rgba 1) (the vector2h #f)) + (add-debug-text-3d #t (bucket-id debug-draw0) "triangle!" p0 (font-color yellow-green) (the vector2h #f)) (add-debug-sphere #t (bucket-id debug-draw0) p2 (meters 0.5) (new 'static 'rgba :r #x80)) ) ) diff --git a/scripts/sublime_text/goal.sublime-syntax b/scripts/sublime_text/goal.sublime-syntax index 5c9cd73640..a3cbaab043 100644 --- a/scripts/sublime_text/goal.sublime-syntax +++ b/scripts/sublime_text/goal.sublime-syntax @@ -13,7 +13,7 @@ contexts: scope: keyword.control.goal # Less important keywords - - match: \b(?i:the-as|the|logior|logand|ash|cons|car|cdr|new|break|none|method-of-type|method-of-object|declare|and|not)\b + - match: \b(?i:the-as|the|logior|logand|ash|cons|car|cdr|new|break|none|method-of-type|method-of-object|declare|and|not|suspend|lambda)\b scope: keyword.operator.goal # Definition forms like (def thing value) diff --git a/test/decompiler/reference/engine/debug/debug-h_REF.gc b/test/decompiler/reference/engine/debug/debug-h_REF.gc index 2f88ebf06b..2f72be3c8e 100644 --- a/test/decompiler/reference/engine/debug/debug-h_REF.gc +++ b/test/decompiler/reference/engine/debug/debug-h_REF.gc @@ -57,6 +57,7 @@ ) ;; definition for method 3 of type debug-vertex-stats +;; INFO: this function exists in multiple non-identical object files (defmethod inspect debug-vertex-stats ((obj debug-vertex-stats)) (format #t "[~8x] ~A~%" obj (-> obj type)) (format #t "~Tlength: ~D~%" (-> obj length)) diff --git a/test/decompiler/reference/engine/debug/menu_REF.gc b/test/decompiler/reference/engine/debug/menu_REF.gc index b6ceaa5a53..7a5cb6dcf9 100644 --- a/test/decompiler/reference/engine/debug/menu_REF.gc +++ b/test/decompiler/reference/engine/debug/menu_REF.gc @@ -51,7 +51,16 @@ (set! (-> gp-0 joypad-item) #f) (set! (-> gp-0 font) - (new 'debug 'font-context *font-default-matrix* 0 0 0.0 0 (the-as uint 3)) + (new + 'debug + 'font-context + *font-default-matrix* + 0 + 0 + 0.0 + (font-color default) + (the-as uint 3) + ) ) gp-0 ) @@ -773,8 +782,11 @@ ) (cond ((= s4-0 'menu) - (let ((s4-1 (new 'debug 'debug-menu arg0 s5-1))) - (set! s5-0 (new 'debug 'debug-menu-item-submenu s5-1 s4-1)) + (let ((s4-1 (new 'debug 'debug-menu arg0 (the-as string s5-1)))) + (set! + s5-0 + (new 'debug 'debug-menu-item-submenu (the-as string s5-1) s4-1) + ) (let* ((gp-1 (cdr (cdr arg1))) (a1-3 (car gp-1)) ) @@ -791,7 +803,7 @@ ) ) ((= s4-0 'main-menu) - (set! s5-0 (new 'debug 'debug-menu arg0 s5-1)) + (set! s5-0 (new 'debug 'debug-menu arg0 (the-as string s5-1))) (let* ((gp-2 (cdr (cdr arg1))) (a1-6 (car gp-2)) ) @@ -816,7 +828,7 @@ (new 'debug 'debug-menu-item-flag - s5-1 + (the-as string s5-1) (the-as symbol (car (cdr (cdr arg1)))) (debug-menu-func-decode (car (cdr (cdr (cdr arg1))))) ) @@ -825,7 +837,7 @@ (new 'debug 'debug-menu-item-function - s5-1 + (the-as string s5-1) (the-as int (car (cdr (cdr arg1)))) (debug-menu-func-decode (car (cdr (cdr (cdr arg1))))) ) @@ -834,7 +846,7 @@ (new 'debug 'debug-menu-item-var - s5-1 + (the-as string s5-1) (the-as int (car (cdr (cdr arg1)))) (the-as int (car (cdr (cdr (cdr arg1))))) ) @@ -849,7 +861,7 @@ (new 'debug 'debug-menu-item-var - s5-1 + (the-as string s5-1) (the-as int (car (cdr (cdr arg1)))) (the-as int (ref arg1 4)) ) @@ -886,7 +898,7 @@ (new 'debug 'debug-menu-item-var - s5-1 + (the-as string s5-1) (the-as int (car (cdr (cdr arg1)))) (the-as int (ref arg1 4)) ) @@ -921,7 +933,7 @@ (new 'debug 'debug-menu-item-var - s5-1 + (the-as string s5-1) (the-as int (car (cdr (cdr arg1)))) (the-as int (ref arg1 4)) ) @@ -1025,16 +1037,17 @@ (set! (-> v1-2 origin x) (the float arg1)) (set! (-> v1-2 origin y) (the float a0-1)) ) - (set! (-> s5-0 color) (cond - ((zero? arg3) - 12 - ) - (arg4 - 11 - ) - (else - 13 - ) + (set! (-> s5-0 color) (the-as font-color (cond + ((zero? arg3) + 12 + ) + (arg4 + 11 + ) + (else + 13 + ) + ) ) ) (let* ((s3-0 (-> *display* frames (-> *display* on-screen) frame debug-buf)) @@ -1080,21 +1093,22 @@ (set! (-> a0-1 origin x) (the float arg1)) (set! (-> a0-1 origin y) (the float a1-1)) ) - (set! (-> v1-2 color) (cond - ((> (-> arg0 hilite-timer) 0) - (+! (-> arg0 hilite-timer) -1) - 10 - ) - ((< (-> arg0 hilite-timer) 0) - (+! (-> arg0 hilite-timer) 1) - 14 - ) - ((nonzero? arg3) - 13 - ) - (else - 12 - ) + (set! (-> v1-2 color) (the-as font-color (cond + ((> (-> arg0 hilite-timer) 0) + (+! (-> arg0 hilite-timer) -1) + 10 + ) + ((< (-> arg0 hilite-timer) 0) + (+! (-> arg0 hilite-timer) 1) + 14 + ) + ((nonzero? arg3) + 13 + ) + (else + 12 + ) + ) ) ) (let* ((s4-0 (-> *display* frames (-> *display* on-screen) frame debug-buf)) @@ -1134,22 +1148,23 @@ (set! (-> a0-1 origin x) (the float arg1)) (set! (-> a0-1 origin y) (the float a1-1)) ) - (set! (-> v1-2 color) (cond - ((= (-> arg0 is-on) 'invalid) - 19 - ) - ((-> arg0 is-on) - (if (zero? arg3) - 15 - 16 - ) - ) - ((zero? arg3) - 17 - ) - (else - 18 - ) + (set! (-> v1-2 color) (the-as font-color (cond + ((= (-> arg0 is-on) 'invalid) + 19 + ) + ((-> arg0 is-on) + (if (zero? arg3) + 15 + 16 + ) + ) + ((zero? arg3) + 17 + ) + (else + 18 + ) + ) ) ) (let* ((s4-0 (-> *display* frames (-> *display* on-screen) frame debug-buf)) @@ -1189,19 +1204,20 @@ (set! (-> v1-2 origin x) (the float arg1)) (set! (-> v1-2 origin y) (the float a0-1)) ) - (set! (-> s5-0 color) (cond - ((zero? arg3) - (if (-> arg0 grabbed-joypad-p) - 10 - 12 - ) - ) - (arg4 - 11 - ) - (else - 13 - ) + (set! (-> s5-0 color) (the-as font-color (cond + ((zero? arg3) + (if (-> arg0 grabbed-joypad-p) + 10 + 12 + ) + ) + (arg4 + 11 + ) + (else + 13 + ) + ) ) ) (let* ((s1-0 (-> *display* frames (-> *display* on-screen) frame debug-buf)) @@ -1364,9 +1380,10 @@ ) (while (not (null? s1-1)) (when (= s0-1 arg3) - (set! (-> arg0 context font color) (if (nonzero? arg4) - 13 - 12 + (set! (-> arg0 context font color) (the-as font-color (if (nonzero? arg4) + 13 + 12 + ) ) ) (let ((v1-16 (-> arg0 context font)) diff --git a/test/decompiler/reference/engine/dma/dma-disasm_REF.gc b/test/decompiler/reference/engine/dma/dma-disasm_REF.gc index a51977aa23..3415a03d71 100644 --- a/test/decompiler/reference/engine/dma/dma-disasm_REF.gc +++ b/test/decompiler/reference/engine/dma/dma-disasm_REF.gc @@ -608,7 +608,7 @@ (if (> (-> arg0 spr) 0) (format arg1 " :spr ~d" (-> arg0 spr)) ) - (if (> (the-as uint (-> arg0 irq)) 0) + (if (> (-> arg0 irq) 0) (format arg1 " :irq ~d" (-> arg0 irq)) ) (if (> (-> arg0 pce) 0) diff --git a/test/decompiler/reference/engine/engine/engines_REF.gc b/test/decompiler/reference/engine/engine/engines_REF.gc index 7ba3bd84d8..df4aacdf21 100644 --- a/test/decompiler/reference/engine/engine/engines_REF.gc +++ b/test/decompiler/reference/engine/engine/engines_REF.gc @@ -16,11 +16,9 @@ ;; definition for symbol *camera-engine*, type engine (define *camera-engine* (new 'global 'engine 'camera-eng 128)) -;; failed to figure out what this is: -(if *debug-segment* - (set! *debug-engine* (new 'debug 'engine 'debug 512)) - ) - - - +;; this part is debug only +(when *debug-segment* +;; definition for symbol *debug-engine*, type engine +(define *debug-engine* (new 'debug 'engine 'debug 512)) +) diff --git a/test/decompiler/reference/engine/game/settings_REF.gc b/test/decompiler/reference/engine/game/settings_REF.gc index a05af74d44..ec1ba65a45 100644 --- a/test/decompiler/reference/engine/game/settings_REF.gc +++ b/test/decompiler/reference/engine/game/settings_REF.gc @@ -42,9 +42,12 @@ (zero? (logand (-> *kernel-context* prevent-from-run) (process-mask progress)) ) - (let ((v1-18 (get-process conn)) - (a0-22 *progress-process*) - ) + (let + ((v1-18 + ((method-of-type connection get-process) (the-as connection conn)) + ) + (a0-22 *progress-process*) + ) (= v1-18 (if a0-22 (-> a0-22 0 self) ) diff --git a/test/decompiler/reference/engine/gfx/font-h_REF.gc b/test/decompiler/reference/engine/gfx/font-h_REF.gc index c11b5c388c..4fad551113 100644 --- a/test/decompiler/reference/engine/gfx/font-h_REF.gc +++ b/test/decompiler/reference/engine/gfx/font-h_REF.gc @@ -53,25 +53,25 @@ ;; definition of type font-context (deftype font-context (basic) - ((origin vector :inline :offset-assert 16) - (strip-gif vector :inline :offset-assert 32) - (width float :offset-assert 48) - (height float :offset-assert 52) - (projection float :offset-assert 56) - (context-vec vector :inline :offset 48) - (color int64 :offset-assert 64) - (color-s32 int32 :offset 64) - (flags uint32 :offset-assert 72) - (flags-signed int32 :offset 72) - (mat matrix :offset-assert 76) - (start-line uint32 :offset-assert 80) - (scale float :offset-assert 84) + ((origin vector :inline :offset-assert 16) + (strip-gif vector :inline :offset-assert 32) + (width float :offset-assert 48) + (height float :offset-assert 52) + (projection float :offset-assert 56) + (context-vec vector :inline :offset 48) + (color font-color :offset-assert 64) + (color-s32 int32 :offset 64) + (flags uint32 :offset-assert 72) + (flags-signed int32 :offset 72) + (mat matrix :offset-assert 76) + (start-line uint32 :offset-assert 80) + (scale float :offset-assert 84) ) :method-count-assert 20 :size-assert #x58 :flag-assert #x1400000058 (:methods - (new (symbol type matrix int int float int uint) _type_ 0) + (new (symbol type matrix int int float font-color uint) _type_ 0) (set-mat! (font-context matrix) font-context 9) (set-origin! (font-context int int) font-context 10) (set-depth! (font-context int) font-context 11) @@ -79,7 +79,7 @@ (set-width! (font-context int) font-context 13) (set-height! (font-context int) font-context 14) (set-projection! (font-context float) font-context 15) - (set-color! (font-context int) font-context 16) + (set-color! (font-context font-color) font-context 16) (set-flags! (font-context uint) font-context 17) (set-start-line! (font-context uint) font-context 18) (set-scale! (font-context float) font-context 19) @@ -146,7 +146,7 @@ ) ;; definition for method 16 of type font-context -(defmethod set-color! font-context ((obj font-context) (color int)) +(defmethod set-color! font-context ((obj font-context) (color font-color)) (set! (-> obj color) color) obj ) @@ -179,7 +179,7 @@ (x int) (y int) (z float) - (color int) + (color font-color) (flags uint) ) (let @@ -258,9 +258,9 @@ (justify vector 64 :inline :offset-assert 944) (color-shadow vector4w :inline :offset-assert 1968) (color-table char-color 64 :inline :offset-assert 1984) - (last-color uint64 :offset-assert 3008) + (last-color font-color :offset-assert 3008) (last-color-32 int32 :offset 3008) - (save-last-color uint64 :offset-assert 3016) + (save-last-color font-color :offset-assert 3016) (save-last-color-32 int32 :offset 3016) (buf basic :offset-assert 3024) (str-ptr uint32 :offset-assert 3028) diff --git a/test/decompiler/reference/engine/gfx/generic/generic_REF.gc b/test/decompiler/reference/engine/gfx/generic/generic_REF.gc index 6cf27abe3c..ae59c6a616 100644 --- a/test/decompiler/reference/engine/gfx/generic/generic_REF.gc +++ b/test/decompiler/reference/engine/gfx/generic/generic_REF.gc @@ -93,8 +93,8 @@ (s2-0 (-> s0-0 base)) ) (if (>= s4-0 7) - (generic-init-buf s0-0 1 s5-0) - (generic-init-buf s0-0 1 gp-0) + (generic-init-buf s0-0 1 (the-as gs-zbuf s5-0)) + (generic-init-buf s0-0 1 (the-as gs-zbuf gp-0)) ) (generic-dma-foreground-sink-init s1-0) (let ((a3-0 (-> s0-0 base))) diff --git a/test/decompiler/reference/engine/gfx/hw/display_REF.gc b/test/decompiler/reference/engine/gfx/hw/display_REF.gc index 290c116cbf..bce48f0cec 100644 --- a/test/decompiler/reference/engine/gfx/hw/display_REF.gc +++ b/test/decompiler/reference/engine/gfx/hw/display_REF.gc @@ -259,7 +259,16 @@ ;; definition for symbol *font-context*, type font-context (define *font-context* - (new 'global 'font-context *font-default-matrix* 0 24 0.0 0 (the-as uint 3)) + (new + 'global + 'font-context + *font-default-matrix* + 0 + 24 + 0.0 + (font-color default) + (the-as uint 3) + ) ) ;; definition for symbol *pause-context*, type font-context @@ -272,7 +281,7 @@ 256 170 0.0 - 3 + (font-color orange-red) (the-as uint 3) ) ) @@ -457,7 +466,7 @@ (*profile-ticks* (let ((s3-0 draw-string-xy)) (format (clear *temp-string*) "~5D" (-> worst-time-cache (/ bar-pos 10))) - (s3-0 *temp-string* buf 488 (+ bar-pos 8) 0 17) + (s3-0 *temp-string* buf 488 (+ bar-pos 8) (font-color default) 17) ) (the float (-> worst-time-cache (/ bar-pos 10))) ) @@ -472,10 +481,16 @@ ) (let ((s4-1 draw-string-xy)) (format (clear *temp-string*) "~5,,2f" f30-0) - (s4-1 *temp-string* buf 488 (+ bar-pos 8) (if (>= f30-0 100.0) - 3 - 0 - ) + (s4-1 + *temp-string* + buf + 488 + (+ bar-pos 8) + (the-as font-color (if (>= f30-0 100.0) + 3 + 0 + ) + ) 17 ) ) diff --git a/test/decompiler/reference/engine/gfx/texture_REF.gc b/test/decompiler/reference/engine/gfx/texture_REF.gc index 62b63d4367..2973fb802d 100644 --- a/test/decompiler/reference/engine/gfx/texture_REF.gc +++ b/test/decompiler/reference/engine/gfx/texture_REF.gc @@ -2944,9 +2944,9 @@ (when (and (nonzero? (-> id page)) - (< (the-as uint (-> id page)) (the-as uint (-> *texture-page-dir* length))) + (< (-> id page) (the-as uint (-> *texture-page-dir* length))) ) - (let ((dir-entry (-> *texture-page-dir* entries (the-as uint (-> id page))))) + (let ((dir-entry (-> *texture-page-dir* entries (-> id page)))) (when (not (-> dir-entry page)) (let ((old-alloc-func (-> *texture-pool* allocate-func))) (set! (-> *texture-pool* allocate-func) alloc-func) @@ -3016,14 +3016,10 @@ (not (or (zero? (-> arg0 page)) - (>= - (the-as uint (-> arg0 page)) - (the-as uint (-> *texture-page-dir* length)) - ) + (>= (-> arg0 page) (the-as uint (-> *texture-page-dir* length))) ) ) - (let - ((dir-entry (-> *texture-page-dir* entries (the-as uint (-> arg0 page))))) + (let ((dir-entry (-> *texture-page-dir* entries (-> arg0 page)))) (if (not (-> dir-entry link)) (set! (-> dir-entry link) @@ -3066,12 +3062,12 @@ (let ((link-slot (&-> link-arr 0)) (shader (the-as adgif-shader (* (-> link-arr 0 shader) 16))) ) - (while (nonzero? (the-as int shader)) + (while (nonzero? (the-as uint shader)) (b! - (< (the-as int (- (the-as int shader) (the-as int mem-start))) 0) + (< (the-as int (- (the-as uint shader) (the-as uint mem-start))) 0) cfg-7 :delay - (set! dist-past-end (- (the-as int shader) mem-end)) + (set! dist-past-end (- (the-as uint shader) mem-end)) ) (b! (>= (the-as int dist-past-end) 0) cfg-7 :delay (nop!)) (let ((t4-2 (-> shader next))) @@ -3352,16 +3348,9 @@ (when (and (nonzero? (-> tex-id page)) - (< - (the-as uint (-> tex-id page)) - (the-as uint (-> *texture-page-dir* length)) - ) + (< (-> tex-id page) (the-as uint (-> *texture-page-dir* length))) ) - (let - ((dir-entry - (-> *texture-page-dir* entries (the-as uint (-> tex-id page))) - ) - ) + (let ((dir-entry (-> *texture-page-dir* entries (-> tex-id page)))) (when (and (< (-> tex-id index) (the-as uint (-> dir-entry length))) @@ -3402,12 +3391,9 @@ (when (and (nonzero? (-> v1-4 page)) - (< - (the-as uint (-> v1-4 page)) - (the-as uint (-> *texture-page-dir* length)) - ) + (< (-> v1-4 page) (the-as uint (-> *texture-page-dir* length))) ) - (let ((a1-7 (-> *texture-page-dir* entries (the-as uint (-> v1-4 page))))) + (let ((a1-7 (-> *texture-page-dir* entries (-> v1-4 page)))) (when (and (< (-> v1-4 index) (the-as uint (-> a1-7 length))) (-> a1-7 link)) (set! (-> arg0 next shader) (-> a1-7 link next (-> v1-4 index) shader)) @@ -3539,7 +3525,7 @@ (the-as object (* (-> entry-link next entry-list-length shader) 16)) ) ) - (while (nonzero? (the-as int v1-40)) + (while (nonzero? (the-as uint v1-40)) (nop!) (+! a3-7 1) (set! v1-40 (* (-> (the-as adgif-shader v1-40) next shader) 16)) diff --git a/test/decompiler/reference/engine/nav/navigate-h_REF.gc b/test/decompiler/reference/engine/nav/navigate-h_REF.gc index e298ccdbcf..5764b04240 100644 --- a/test/decompiler/reference/engine/nav/navigate-h_REF.gc +++ b/test/decompiler/reference/engine/nav/navigate-h_REF.gc @@ -557,7 +557,10 @@ ) (set! (-> obj max-spheres) sphere-count) (set! (-> obj flags) (nav-control-flags bit8 bit13)) - (set! (-> obj mesh) (nav-mesh-connect (-> shape process) shape obj)) + (set! + (-> obj mesh) + (nav-mesh-connect (-> shape process) shape (the-as nav-control obj)) + ) (let ((ent (-> shape process entity))) (set! (-> obj nearest-y-threshold) diff --git a/test/decompiler/reference/engine/nav/path_REF.gc b/test/decompiler/reference/engine/nav/path_REF.gc index 7968fe9cbe..52ed8ede33 100644 --- a/test/decompiler/reference/engine/nav/path_REF.gc +++ b/test/decompiler/reference/engine/nav/path_REF.gc @@ -25,7 +25,7 @@ (the-as bucket-id s3-0) *temp-string* (-> obj process root trans) - (new 'static 'rgba :r #x3) + (font-color orange-red) (the-as vector2h #f) ) ) @@ -73,7 +73,7 @@ (the-as bucket-id s1-0) *temp-string* s4-1 - (new 'static 'rgba :r #x4) + (font-color bright-orange-red) (the-as vector2h #f) ) ) @@ -395,7 +395,7 @@ (the-as bucket-id s3-0) *temp-string* (-> obj process root trans) - (new 'static 'rgba :r #x3) + (font-color orange-red) (the-as vector2h #f) ) ) @@ -441,7 +441,7 @@ (the-as bucket-id s1-0) *temp-string* s4-1 - (new 'static 'rgba :r #x4) + (font-color bright-orange-red) (the-as vector2h #f) ) ) diff --git a/test/decompiler/reference/engine/ps2/memcard-h_REF.gc b/test/decompiler/reference/engine/ps2/memcard-h_REF.gc index f8af12dc2f..0719980874 100644 --- a/test/decompiler/reference/engine/ps2/memcard-h_REF.gc +++ b/test/decompiler/reference/engine/ps2/memcard-h_REF.gc @@ -142,7 +142,14 @@ ) ) ) - (draw-string-xy *temp-string* dma-buf 32 (+ (* 12 slot-idx) 8) 3 1) + (draw-string-xy + *temp-string* + dma-buf + 32 + (+ (* 12 slot-idx) 8) + (font-color orange-red) + 1 + ) ) ) 0 diff --git a/test/decompiler/reference/engine/sound/gsound_REF.gc b/test/decompiler/reference/engine/sound/gsound_REF.gc index 6c006b9821..7f918ee495 100644 --- a/test/decompiler/reference/engine/sound/gsound_REF.gc +++ b/test/decompiler/reference/engine/sound/gsound_REF.gc @@ -1021,7 +1021,7 @@ arg0 (+ (* s5-0 16) 16) 48 - 0 + (font-color default) 1 ) ) @@ -1033,7 +1033,7 @@ arg0 (+ (* s5-1 16) 16) 64 - 0 + (font-color default) 1 ) ) @@ -1049,7 +1049,7 @@ (-> *sound-iop-info* freemem) (shr (-> *sound-iop-info* freemem) 10) ) - (s5-0 *temp-string* arg0 32 96 0 1) + (s5-0 *temp-string* arg0 32 96 (font-color default) 1) ) (let ((s5-1 draw-string-xy)) (format @@ -1058,7 +1058,7 @@ (-> *sound-iop-info* freemem2) (shr (-> *sound-iop-info* freemem2) 10) ) - (s5-1 *temp-string* arg0 32 64 0 1) + (s5-1 *temp-string* arg0 32 64 (font-color default) 1) ) 0 ) diff --git a/test/decompiler/reference/engine/ui/credits_REF.gc b/test/decompiler/reference/engine/ui/credits_REF.gc index 62b7490664..a7956d0c2f 100644 --- a/test/decompiler/reference/engine/ui/credits_REF.gc +++ b/test/decompiler/reference/engine/ui/credits_REF.gc @@ -84,7 +84,7 @@ 0 0 0.0 - 0 + (font-color default) (the-as uint 3) ) ) @@ -165,7 +165,16 @@ (s3-0 0) (s2-0 #t) (s5-0 - (new 'stack 'font-context *font-default-matrix* 31 0 0.0 0 (the-as uint 3)) + (new + 'stack + 'font-context + *font-default-matrix* + 31 + 0 + 0.0 + (font-color default) + (the-as uint 3) + ) ) ) (let ((v1-2 s5-0)) diff --git a/test/decompiler/reference/kernel/gkernel_REF.gc b/test/decompiler/reference/kernel/gkernel_REF.gc index 5efeae6b9c..140ba11030 100644 --- a/test/decompiler/reference/kernel/gkernel_REF.gc +++ b/test/decompiler/reference/kernel/gkernel_REF.gc @@ -1884,14 +1884,15 @@ (new 'global 'dead-pool 1 8192 '*camera-master-dead-pool*) ) -;; failed to figure out what this is: -(if *debug-segment* - (set! - *debug-dead-pool* - (new 'debug 'dead-pool-heap '*debug-dead-pool* 768 #x100000) - ) +;; this part is debug only +(when *debug-segment* +;; definition for symbol *debug-dead-pool*, type dead-pool-heap +(define + *debug-dead-pool* + (new 'debug 'dead-pool-heap '*debug-dead-pool* 768 #x100000) ) +) ;; definition for symbol *nk-dead-pool*, type dead-pool-heap (define *nk-dead-pool* (new 'global 'dead-pool-heap '*nk-dead-pool* 768 #xf6000))