diff --git a/.github/workflows/linux-build-clang.yaml b/.github/workflows/linux-build-clang.yaml index 6685301534..11123d0b24 100644 --- a/.github/workflows/linux-build-clang.yaml +++ b/.github/workflows/linux-build-clang.yaml @@ -53,6 +53,14 @@ jobs: fetch-depth: 0 fetch-tags: true + # full checkout with tags if we ARE uploading artifacts + - name: Checkout Repository with Tags + if: ${{ inputs.uploadArtifacts }} + uses: actions/checkout@v4 + with: + fetch-depth: 0 + fetch-tags: true + - name: Install Package Dependencies run: | sudo apt update diff --git a/.github/workflows/macos-build.yaml b/.github/workflows/macos-build.yaml index 8f09eac344..8fe8177d3f 100644 --- a/.github/workflows/macos-build.yaml +++ b/.github/workflows/macos-build.yaml @@ -53,6 +53,14 @@ jobs: fetch-depth: 0 fetch-tags: true + # full checkout with tags if we ARE uploading artifacts + - name: Checkout Repository with Tags + if: ${{ inputs.uploadArtifacts }} + uses: actions/checkout@v4 + with: + fetch-depth: 0 + fetch-tags: true + - name: Install Package Dependencies run: brew install cmake nasm ninja diff --git a/.github/workflows/windows-build-clang.yaml b/.github/workflows/windows-build-clang.yaml index e2c899dce5..a412815932 100644 --- a/.github/workflows/windows-build-clang.yaml +++ b/.github/workflows/windows-build-clang.yaml @@ -54,6 +54,14 @@ jobs: fetch-depth: 0 fetch-tags: true + # full checkout with tags if we ARE uploading artifacts + - name: Checkout Repository with Tags + if: ${{ inputs.uploadArtifacts }} + uses: actions/checkout@v4 + with: + fetch-depth: 0 + fetch-tags: true + - name: Install NASM # TODO - Simplify this with just the first command once choco 2.0 rolls out everywhere run: | diff --git a/common/formatter/rules/rule_config.cpp b/common/formatter/rules/rule_config.cpp index 829e539d88..9c64a6adf7 100644 --- a/common/formatter/rules/rule_config.cpp +++ b/common/formatter/rules/rule_config.cpp @@ -168,6 +168,39 @@ static FormFormattingConfig new_deftype_rule( return cfg; } +static FormFormattingConfig new_defproc_rule( + int start_index, + int num_columns_to_compute_widths, + const std::vector& inlining_preventation_indices) { + FormFormattingConfig cfg; + cfg.has_constant_pairs = true; + cfg.config_set = true; + cfg.hang_forms = false; + cfg.inline_until_index = [start_index](std::vector curr_lines) { + // if (curr_lines.size() >= 4 && curr_lines.at(3) == "()") { + // return 4; + // } + return start_index; + }; + for (const auto& index : inlining_preventation_indices) { + auto temp_config = std::make_shared(); + temp_config->config_set = true; + temp_config->prevent_inlining = true; + temp_config->hang_forms = false; + temp_config->indentation_width = 1; + auto temp_list_config = std::make_shared(); + temp_list_config->force_inline = false; + temp_list_config->hang_forms = false; + temp_config->default_index_config = temp_list_config; + if (index == 3) { + temp_config->determine_column_widths_for_list_elements = true; + temp_config->num_columns_to_compute_widths = num_columns_to_compute_widths; + } + cfg.index_configs.emplace(index, temp_config); + } + return cfg; +} + static FormFormattingConfig new_binding_rule(int form_head_width) { FormFormattingConfig cfg; cfg.config_set = true; @@ -253,6 +286,9 @@ const std::unordered_map opengoal_form_config {"defmethod", new_defmethod_rule(3)}, {"lambda", new_lambda_rule(2)}, {"deftype", new_deftype_rule(3, 1, {3, 4, 5, 6})}, + {"defproc", new_defproc_rule(3, 1, {3, 4, 5, 6})}, + {"suspend-for", new_flow_rule(2)}, + {"spawn-proc", new_flow_rule(2)}, {"defun", new_flow_rule(3)}, {"defun-recursive", new_flow_rule(4)}, {"defun-debug-recursive", new_flow_rule(4)}, @@ -281,12 +317,14 @@ const std::unordered_map opengoal_form_config {"protect", new_binding_rule(4)}, {"let*", new_binding_rule(5)}, {"rlet", new_binding_rule(5)}, + {"mlet", new_binding_rule(5)}, {"when", new_flow_rule(2)}, {"unless", new_flow_rule(2)}, {"with-profiler", new_flow_rule(2)}, {"with-pc", new_flow_rule(0)}, {"#unless", new_flow_rule(2)}, {"#when", new_flow_rule(2)}, + {"#when-game", new_flow_rule(2)}, {"countdown", new_flow_rule(2)}, {"until", new_flow_rule(2)}, {"loop", new_flow_rule(0)}, diff --git a/common/util/gltf_util.cpp b/common/util/gltf_util.cpp index 105a056414..1d3115089f 100644 --- a/common/util/gltf_util.cpp +++ b/common/util/gltf_util.cpp @@ -577,7 +577,7 @@ void setup_alpha_from_material(const tinygltf::Material& material, DrawMode* mod void setup_draw_mode_from_sampler(const tinygltf::Sampler& sampler, DrawMode* mode) { if (sampler.magFilter == TINYGLTF_TEXTURE_FILTER_NEAREST) { - ASSERT(sampler.minFilter == TINYGLTF_TEXTURE_FILTER_NEAREST); + ASSERT(sampler.minFilter == TINYGLTF_TEXTURE_FILTER_NEAREST_MIPMAP_NEAREST); mode->set_filt_enable(false); } else { ASSERT(sampler.minFilter != TINYGLTF_TEXTURE_FILTER_NEAREST); diff --git a/decompiler/config/jak3/ntsc_v1/inputs.jsonc b/decompiler/config/jak3/ntsc_v1/inputs.jsonc index b5f47006d1..ffd7135048 100644 --- a/decompiler/config/jak3/ntsc_v1/inputs.jsonc +++ b/decompiler/config/jak3/ntsc_v1/inputs.jsonc @@ -186,7 +186,7 @@ "DGO/PRECA.DGO", "DGO/PRECB.DGO", "DGO/PRECC.DGO", - // "DGO/PRECD.DGO", + "DGO/PRECD.DGO", // title/intro "DGO/WIN.DGO", // wasintro "DGO/TITLE.DGO", diff --git a/decompiler/level_extractor/BspHeader.cpp b/decompiler/level_extractor/BspHeader.cpp index 5413407f3a..f69c4eef99 100644 --- a/decompiler/level_extractor/BspHeader.cpp +++ b/decompiler/level_extractor/BspHeader.cpp @@ -1017,7 +1017,8 @@ void PrototypeBucketTie::read_from_file(TypedRef ref, for (int i = 0; i < 4; i++) { u32 start = index_start[i]; u32 end = start + frag_count[i]; - ASSERT(num_color_qwcs <= end); + // precd tie has a bug where geo 3's + // ASSERT(num_color_qwcs <= end); num_color_qwcs = std::max(end, num_color_qwcs); } diff --git a/decompiler/level_extractor/extract_tie.cpp b/decompiler/level_extractor/extract_tie.cpp index 577edb2c06..53ce30a09a 100644 --- a/decompiler/level_extractor/extract_tie.cpp +++ b/decompiler/level_extractor/extract_tie.cpp @@ -2753,6 +2753,10 @@ void extract_tie(const level_tools::DrawableTreeInstanceTie* tree, bool dump_level, GameVersion version) { for (int geo = 0; geo < GEOM_MAX; ++geo) { + // as far as I can tell, this one has bad colors + if (debug_name == "PRECD.DGO-2-tie" && geo == 3) { + continue; + } tfrag3::TieTree this_tree; // sanity check the vis tree (not a perfect check, but this is used in game and should be right) diff --git a/game/kernel/common/kmachine.cpp b/game/kernel/common/kmachine.cpp index 8f7add68fa..eb86a91859 100644 --- a/game/kernel/common/kmachine.cpp +++ b/game/kernel/common/kmachine.cpp @@ -1107,6 +1107,15 @@ void pc_register_screen_shot_settings(u32 ptr) { register_screen_shot_settings(Ptr(ptr).c()); } +void pc_encode_utf8_string(u32 src_str_ptr, u32 str_dest_ptr) { + auto str = std::string(Ptr(src_str_ptr).c()->data()); + std::string version = version_to_game_name(g_game_version); + const std::string font_bank_name = version == "jak1" ? "jak1-v2" : version; + std::string converted = + get_font_bank(get_text_version_from_name(font_bank_name))->convert_utf8_to_game(str); + strcpy(Ptr(str_dest_ptr).c()->data(), converted.c_str()); +} + /// Initializes all functions that are common across all game versions /// These functions have the same implementation and do not use any game specific functions (other /// than the one to create a function in the first place) @@ -1225,6 +1234,9 @@ void init_common_pc_port_functions( // RNG make_func_symbol_func("pc-rand", (void*)pc_rand); + // text + make_func_symbol_func("pc-encode-utf8-string", (void*)pc_encode_utf8_string); + // debugging tools make_func_symbol_func("pc-filter-debug-string?", (void*)pc_filter_debug_string); make_func_symbol_func("pc-screen-shot", (void*)pc_screen_shot); diff --git a/game/kernel/jak2/kmachine.cpp b/game/kernel/jak2/kmachine.cpp index aa11bc7fde..f2bee0fd6f 100644 --- a/game/kernel/jak2/kmachine.cpp +++ b/game/kernel/jak2/kmachine.cpp @@ -541,7 +541,6 @@ void InitMachine_PCPort() { make_function_symbol_from_c("__pc-get-tex-remap", (void*)lookup_jak2_texture_dest_offset); make_function_symbol_from_c("pc-init-autosplitter-struct", (void*)kmachine_extras::init_autosplit_struct); - make_function_symbol_from_c("pc-encode-utf8-string", (void*)kmachine_extras::encode_utf8_string); // discord rich presence make_function_symbol_from_c("pc-discord-rpc-update", (void*)kmachine_extras::update_discord_rpc); diff --git a/game/kernel/jak2/kmachine_extras.cpp b/game/kernel/jak2/kmachine_extras.cpp index 0f8c2c1a69..7faf3d806d 100644 --- a/game/kernel/jak2/kmachine_extras.cpp +++ b/game/kernel/jak2/kmachine_extras.cpp @@ -196,13 +196,6 @@ inline bool symbol_to_bool(const u32 symptr) { return symptr != s7.offset; } -// TODO - move to common -void encode_utf8_string(u32 src_str_ptr, u32 str_dest_ptr) { - auto str = std::string(Ptr(src_str_ptr).c()->data()); - std::string converted = get_font_bank(GameTextVersion::JAK2)->convert_utf8_to_game(str); - strcpy(Ptr(str_dest_ptr).c()->data(), converted.c_str()); -} - void init_autosplit_struct() { g_auto_splitter_block_jak2.pointer_to_symbol = (u64)g_ee_main_mem + (u64)intern_from_c("*autosplit-info-jak2*")->value(); diff --git a/game/kernel/jak3/kmachine.cpp b/game/kernel/jak3/kmachine.cpp index 64a48a14e6..836168c6b3 100644 --- a/game/kernel/jak3/kmachine.cpp +++ b/game/kernel/jak3/kmachine.cpp @@ -370,7 +370,6 @@ void InitMachine_PCPort() { (void*)kmachine_extras::pc_set_active_levels); make_function_symbol_from_c("__pc-get-tex-remap", (void*)lookup_jak3_texture_dest_offset); // make_function_symbol_from_c("pc-init-autosplitter-struct", (void*)init_autosplit_struct); - make_function_symbol_from_c("pc-encode-utf8-string", (void*)kmachine_extras::encode_utf8_string); // discord rich presence make_function_symbol_from_c("pc-discord-rpc-update", (void*)kmachine_extras::update_discord_rpc); diff --git a/game/kernel/jak3/kmachine_extras.cpp b/game/kernel/jak3/kmachine_extras.cpp index 035bb10454..626be6a067 100644 --- a/game/kernel/jak3/kmachine_extras.cpp +++ b/game/kernel/jak3/kmachine_extras.cpp @@ -183,12 +183,5 @@ inline bool symbol_to_bool(const u32 symptr) { return symptr != s7.offset; } -// TODO - move to common -void encode_utf8_string(u32 src_str_ptr, u32 str_dest_ptr) { - auto str = std::string(Ptr(src_str_ptr).c()->data()); - std::string converted = get_font_bank(GameTextVersion::JAK3)->convert_utf8_to_game(str); - strcpy(Ptr(str_dest_ptr).c()->data(), converted.c_str()); -} - } // namespace kmachine_extras } // namespace jak3 diff --git a/goal_src/jak1/kernel-defs.gc b/goal_src/jak1/kernel-defs.gc index ff72e334cb..502c8d0cef 100644 --- a/goal_src/jak1/kernel-defs.gc +++ b/goal_src/jak1/kernel-defs.gc @@ -594,6 +594,8 @@ (define-extern pc-rand (function int)) +(define-extern pc-encode-utf8-string (function string string none)) + ;; Constants generated within the C++ runtime (define-extern *pc-user-dir-base-path* string) diff --git a/goal_src/jak2/engine/gfx/texture/texture-anim.gc b/goal_src/jak2/engine/gfx/texture/texture-anim.gc index 0c60c0815e..69fef2edd1 100644 --- a/goal_src/jak2/engine/gfx/texture/texture-anim.gc +++ b/goal_src/jak2/engine/gfx/texture/texture-anim.gc @@ -946,7 +946,7 @@ struct SlimeInput { (return #f) ) ((= anim-array *kor-transform-texture-anim-array*) - (pc-clut-blender bucket (texture-anim-pc kor-transform) anim-array) + ; (pc-clut-blender bucket (texture-anim-pc kor-transform) anim-array) (return #f) ) (else diff --git a/goal_src/jak2/pc/pckernel-impl.gc b/goal_src/jak2/pc/pckernel-impl.gc index 80b67d71a6..ded9aac848 100644 --- a/goal_src/jak2/pc/pckernel-impl.gc +++ b/goal_src/jak2/pc/pckernel-impl.gc @@ -168,7 +168,7 @@ (set! (-> obj memcard-volume-dialog) 0.75) (set! (-> obj memcard-vibration?) #t) (set! (-> obj memcard-subtitles?) #f) - (set! (-> obj hint-subtitles?) #t) + (set! (-> obj hinttitles?) #t) 0) (defmethod reset-extra ((obj pc-settings-jak2) (call-handlers symbol)) diff --git a/goal_src/jak2/pc/pckernel.gc b/goal_src/jak2/pc/pckernel.gc index 85b8031b14..71b07c117a 100644 --- a/goal_src/jak2/pc/pckernel.gc +++ b/goal_src/jak2/pc/pckernel.gc @@ -768,7 +768,7 @@ (("cheats-unlocked") (set! (-> obj cheats-unlocked) (the-as pc-cheats (file-stream-read-int file)))) (("cheats-backup") (file-stream-read-int file)) ;; TODO - Don't remove this, parsing code can't handle unexpected keys (("memcard-subtitles?") (set! (-> obj memcard-subtitles?) (file-stream-read-symbol file))) - (("hint-subtitles?") (set! (-> obj hint-subtitles?) (file-stream-read-symbol file))) + (("hint-subtitles?") (file-stream-read-symbol file)) (("music-unlocked") (dotimes (i (/ (align64 (-> obj music-unlocked length)) 64)) (bit-array<-int64 (-> obj music-unlocked) (* i 64) (file-stream-read-int file)) diff --git a/goal_src/jak2/pc/progress/progress-static-pc.gc b/goal_src/jak2/pc/progress/progress-static-pc.gc index 16d2fc6e32..f8f9ee5cbe 100644 --- a/goal_src/jak2/pc/progress/progress-static-pc.gc +++ b/goal_src/jak2/pc/progress/progress-static-pc.gc @@ -341,10 +341,9 @@ This gives us more freedom to write code how we want. :name (text-id progress-hint-subtitles) :truthy-text (text-id progress-on) :falsey-text (text-id progress-off) - :get-value-fn (lambda () (-> *pc-settings* hint-subtitles?)) - :should-disable? (lambda () (not (-> *pc-settings* memcard-subtitles?))) + :get-value-fn (lambda () (-> *pc-settings* hinttitles?)) :on-confirm (lambda ((val symbol)) - (set! (-> *pc-settings* hint-subtitles?) val) + (set! (-> *pc-settings* hinttitles?) val) (pc-settings-save)))) (defmacro game-options-pc-subtitle-language () diff --git a/goal_src/jak2/pc/subtitle2.gc b/goal_src/jak2/pc/subtitle2.gc index cc6adda6a9..0f13aef3ab 100644 --- a/goal_src/jak2/pc/subtitle2.gc +++ b/goal_src/jak2/pc/subtitle2.gc @@ -471,8 +471,8 @@ (set! (-> self font origin y) cur-y) ;; check if we should actually draw subtitles and do it - (when (and (-> *setting-control* user-current subtitle) - (or (-> self movie-mode?) (-> *pc-settings* hint-subtitles?)) + (when (and (if (-> self movie-mode?) (-> *setting-control* user-current subtitle) + (-> *pc-settings* hinttitles?)) (or *gui-kick-str* (= *master-mode* 'game))) (set-action! *gui-control* (gui-action play) (-> self gui-id) (gui-channel none) (gui-action none) (the-as string #f) (the-as (function gui-connection symbol) #f) (the-as process #f)) diff --git a/goal_src/jak3/game.gp b/goal_src/jak3/game.gp index 766c047422..a5bf480cbf 100644 --- a/goal_src/jak3/game.gp +++ b/goal_src/jak3/game.gp @@ -272,7 +272,7 @@ (cgo-file "preca.gd" common-dep) (cgo-file "precb.gd" common-dep) (cgo-file "precc.gd" common-dep) -; (cgo-file "precd.gd" common-dep) +(cgo-file "precd.gd" common-dep) ; ;; title/intro (cgo-file "win.gd" common-dep) ;; wasintro (cgo-file "title.gd" common-dep) diff --git a/out/build/Release/bin/decompiler.exe b/out/build/Release/bin/decompiler.exe index 0c65223054..e75c3286e2 100644 Binary files a/out/build/Release/bin/decompiler.exe and b/out/build/Release/bin/decompiler.exe differ diff --git a/out/build/Release/bin/extractor.exe b/out/build/Release/bin/extractor.exe index 6ce54e95ed..eee86b1c41 100644 Binary files a/out/build/Release/bin/extractor.exe and b/out/build/Release/bin/extractor.exe differ diff --git a/out/build/Release/bin/gk.exe b/out/build/Release/bin/gk.exe index 9b6e82a7cb..e8cf266db9 100644 Binary files a/out/build/Release/bin/gk.exe and b/out/build/Release/bin/gk.exe differ diff --git a/out/build/Release/bin/goalc.exe b/out/build/Release/bin/goalc.exe index 7f7eed7505..226c4f489b 100644 Binary files a/out/build/Release/bin/goalc.exe and b/out/build/Release/bin/goalc.exe differ