Skip to content

Commit

Permalink
vanilla merge 11/4
Browse files Browse the repository at this point in the history
  • Loading branch information
dallmeyer committed Nov 5, 2024
2 parents e7ba9a6 + 1e53071 commit 16c0c95
Show file tree
Hide file tree
Showing 24 changed files with 92 additions and 28 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/linux-build-clang.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/macos-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/windows-build-clang.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
38 changes: 38 additions & 0 deletions common/formatter/rules/rule_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<int>& 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<std::string> 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<FormFormattingConfig>();
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<FormFormattingConfig>();
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;
Expand Down Expand Up @@ -253,6 +286,9 @@ const std::unordered_map<std::string, FormFormattingConfig> 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)},
Expand Down Expand Up @@ -281,12 +317,14 @@ const std::unordered_map<std::string, FormFormattingConfig> 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)},
Expand Down
2 changes: 1 addition & 1 deletion common/util/gltf_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion decompiler/config/jak3/ntsc_v1/inputs.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 2 additions & 1 deletion decompiler/level_extractor/BspHeader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
4 changes: 4 additions & 0 deletions decompiler/level_extractor/extract_tie.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
12 changes: 12 additions & 0 deletions game/kernel/common/kmachine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1107,6 +1107,15 @@ void pc_register_screen_shot_settings(u32 ptr) {
register_screen_shot_settings(Ptr<ScreenShotSettings>(ptr).c());
}

void pc_encode_utf8_string(u32 src_str_ptr, u32 str_dest_ptr) {
auto str = std::string(Ptr<String>(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<String>(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)
Expand Down Expand Up @@ -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);
Expand Down
1 change: 0 additions & 1 deletion game/kernel/jak2/kmachine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
7 changes: 0 additions & 7 deletions game/kernel/jak2/kmachine_extras.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<String>(src_str_ptr).c()->data());
std::string converted = get_font_bank(GameTextVersion::JAK2)->convert_utf8_to_game(str);
strcpy(Ptr<String>(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();
Expand Down
1 change: 0 additions & 1 deletion game/kernel/jak3/kmachine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
7 changes: 0 additions & 7 deletions game/kernel/jak3/kmachine_extras.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<String>(src_str_ptr).c()->data());
std::string converted = get_font_bank(GameTextVersion::JAK3)->convert_utf8_to_game(str);
strcpy(Ptr<String>(str_dest_ptr).c()->data(), converted.c_str());
}

} // namespace kmachine_extras
} // namespace jak3
2 changes: 2 additions & 0 deletions goal_src/jak1/kernel-defs.gc
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion goal_src/jak2/engine/gfx/texture/texture-anim.gc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion goal_src/jak2/pc/pckernel-impl.gc
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion goal_src/jak2/pc/pckernel.gc
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
5 changes: 2 additions & 3 deletions goal_src/jak2/pc/progress/progress-static-pc.gc
Original file line number Diff line number Diff line change
Expand Up @@ -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 ()
Expand Down
4 changes: 2 additions & 2 deletions goal_src/jak2/pc/subtitle2.gc
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion goal_src/jak3/game.gp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Binary file modified out/build/Release/bin/decompiler.exe
Binary file not shown.
Binary file modified out/build/Release/bin/extractor.exe
Binary file not shown.
Binary file modified out/build/Release/bin/gk.exe
Binary file not shown.
Binary file modified out/build/Release/bin/goalc.exe
Binary file not shown.

0 comments on commit 16c0c95

Please sign in to comment.